Hi experts,
I have a variable admitdt with a format $CHAR10. and displays value 21/07/2015.
I need to convert it in to YYMMDD10. format for which i have separated in to month date year separately and later using MDY function to join them as they cann't be converted directly to numeric by input function.
I'm using these formats to separate theall the 3 components out.
dt=input(substr(admitdt,1,2),best.); month =input(substr(admitdt,4,2),best2.);
year=input(substr(admitdt,7,4),best.); addt=mdy(dt,month,year);
The month data which is giving 7 after conversion for which i have tried using z2. informat by which it throws error by saying z2. informat is not found or loaded and gives blank to my surprise .
If there is a other way out, kindly help me out with some suggestion.
I think that you didn't delve deep enough into INFORMATs for dates.
Your example string is appropriate to read with ddmmyy10. informat.
data example; x='21/07/2015'; y = input(x,ddmmyy10.); format y yymmdd10.; run;
If the DDMMYY10 informat does not work then provide 1) actual examples of the data and 2) the code you used with the informat.
You can not use something, such as the example above of: x = input(x,ddyymm10.); because once a variable is defined as character you cannot change it to numeric. (Just in case that is why you thing it won't work)
I think that you didn't delve deep enough into INFORMATs for dates.
Your example string is appropriate to read with ddmmyy10. informat.
data example; x='21/07/2015'; y = input(x,ddmmyy10.); format y yymmdd10.; run;
If the DDMMYY10 informat does not work then provide 1) actual examples of the data and 2) the code you used with the informat.
You can not use something, such as the example above of: x = input(x,ddyymm10.); because once a variable is defined as character you cannot change it to numeric. (Just in case that is why you thing it won't work)
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.