tag:blogger.com,1999:blog-7958828565254404797.post6462973039078799357..comments2024-03-28T07:44:59.527-07:00Comments on ListenData: SAS : Convert Character Variable to DateDeepanshu Bhallahttp://www.blogger.com/profile/09802839558125192674noreply@blogger.comBlogger14125tag:blogger.com,1999:blog-7958828565254404797.post-48094747234111159872024-02-12T19:37:37.478-08:002024-02-12T19:37:37.478-08:00He'll I'm Narasimha, please can suggest me...He'll I'm Narasimha, please can suggest me how to convert character date like 12-aug-2023 to numeric date format ( character date has the format 11.)Narasimhahttps://www.blogger.com/profile/07329487481778086468noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-86961289134236429622022-01-26T14:07:31.293-08:002022-01-26T14:07:31.293-08:00Hi,
TO convert from character to numeric use input...Hi,<br />TO convert from character to numeric use input function. check the below code.<br />data temp;<br />input val $;<br />datalines;<br />20<br />21<br />;<br />run;<br /><br />data tem;<br />set temp;<br />new= input(val,2.);<br />run;<br /><br />proc contents data= tem;<br />run;<br /><br />check the below link for more conversions of data.<br />https://blogs.sas.com/content/sgf/2015/05/01/converting-variable-types-do-i-use-put-or-input/ravihttps://www.blogger.com/profile/12051180291065695712noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-15932041234346378962020-01-30T04:11:36.797-08:002020-01-30T04:11:36.797-08:00i have character value of <18 and i want to cha...i have character value of <18 and i want to change it to Numeric value can anyone help me.....Anonymoushttps://www.blogger.com/profile/14802853792441072311noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-56160968461466262262019-02-26T02:05:55.816-08:002019-02-26T02:05:55.816-08:00data example;
input dateofbirth $20.;
cards;
05/11...data example;<br />input dateofbirth $20.;<br />cards;<br />05/11/1980<br />07/05/1990<br />04/14/1981<br />;<br />run;<br /><br />change month 14 to other iqanihttps://www.blogger.com/profile/06795360088796980175noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-48986044993373590672019-01-18T01:27:10.044-08:002019-01-18T01:27:10.044-08:00Hi Deepanshu,
Can you please fix the image? Thank...Hi Deepanshu,<br /><br />Can you please fix the image? Thank you so much<br /><br />LongLong Nguyenhttps://www.blogger.com/profile/08179879332910389940noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-6239770972831938162018-05-02T19:43:26.239-07:002018-05-02T19:43:26.239-07:00didn't workdidn't workSoonhttps://www.blogger.com/profile/14604157232144321767noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-22152606321643248882017-06-15T02:44:55.264-07:002017-06-15T02:44:55.264-07:00date11. format. I have added an example of this fo...date11. format. I have added an example of this format in the article. Thanks!Deepanshu Bhallahttps://www.blogger.com/profile/09802839558125192674noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-1828736726941634892017-06-15T02:04:55.999-07:002017-06-15T02:04:55.999-07:00Hello Deepanshu,can you please let me know the for...Hello Deepanshu,can you please let me know the format for the following date 10/Jun/2017Anonymoushttps://www.blogger.com/profile/08923379328712741865noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-18078762521255115062017-02-02T09:16:02.476-08:002017-02-02T09:16:02.476-08:00Check out this code -
data temp;
length x $23.;
in...Check out this code -<br />data temp;<br />length x $23.;<br />input x$;<br />y = INPUT(substr(strip(x),1,10),yymmdd10.) ;<br />format y ddmmyy10.;<br />cards;<br />2007-05-0400:00:00.000<br />;<br />proc print;<br />run;Deepanshu Bhallahttps://www.blogger.com/profile/09802839558125192674noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-34096286278619422982017-02-02T06:22:15.318-08:002017-02-02T06:22:15.318-08:00Hi Deepanshu, I have the same problem than Manjuna...Hi Deepanshu, I have the same problem than Manjunatha, I've a variable in format $CHAR23(2007-05-04 00:00:00.000) and I want obtain a new variable with ddmmyy10 format, I try to do the change by your way but that result a missing value.<br />Could you help me with this ? Thanks!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-49347216759883596112016-11-08T11:01:54.792-08:002016-11-08T11:01:54.792-08:00Could you please post an example of your date vari...Could you please post an example of your date variable?Deepanshu Bhallahttps://www.blogger.com/profile/09802839558125192674noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-8760626670440750922016-11-07T20:25:17.520-08:002016-11-07T20:25:17.520-08:00Hi Deepanshu, This is Manjunatha. In the dataset1,...Hi Deepanshu, This is Manjunatha. In the dataset1, the date variable is character$9. When I tried to convert it Eg: Newdate=input(strip(date),mmddyy10.); format Newdate mmddyy10. It is showing as missing values (.). Please help.thanks.Anonymoushttps://www.blogger.com/profile/12350334997125276567noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-13859962496006690432016-06-10T09:45:43.667-07:002016-06-10T09:45:43.667-07:00Thanks Arvind for your appreciation. Cheers!Thanks Arvind for your appreciation. Cheers!Deepanshu Bhallahttps://www.blogger.com/profile/09802839558125192674noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-49923548088753927722016-06-06T19:46:22.472-07:002016-06-06T19:46:22.472-07:00Hi, this is Arvind, your site is really good, whil...Hi, this is Arvind, your site is really good, while checking SAS tutorial, i felt it really good because you mention there each and every small thing so nicely. so thanks for that.Anonymoushttps://www.blogger.com/profile/02490587070137875291noreply@blogger.com