Have a date field on INFILE with format CCYY.JJJ and need to convert to SAS date. Can't seem to wrap my head around this for some reason. Example of input date:
2020.350
Remove the period and use JULIAN7. informat. Or parse out the YEAR and DAYS part and re-combine them.
data test;
input str $ ;
date1=input(compress(str,'.'),julian7.);
date2=mdy(1,1,input(str,4.))+input(scan(str,2,'.'),3.)-1;
format date: yymmdd10.;
put (_all_) (=);
cards;
2020.350
2020.001
;
What should that map to? Is 350 the # of days? ie roughly December 15/16, 2020?
If so, I think that's a Julian Date.
https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=leforinforref&docsetTarge...
data test;
date='2018099';
sasdate=input(date,julian7.);
put sasdate ;
put sasdate date9.;
run;
@G_I_Jeff wrote:
Have a date field on INFILE with format CCYY.JJJ and need to convert to SAS date. Can't seem to wrap my head around this for some reason. Example of input date:
2020.350
Remove the period and use JULIAN7. informat. Or parse out the YEAR and DAYS part and re-combine them.
data test;
input str $ ;
date1=input(compress(str,'.'),julian7.);
date2=mdy(1,1,input(str,4.))+input(scan(str,2,'.'),3.)-1;
format date: yymmdd10.;
put (_all_) (=);
cards;
2020.350
2020.001
;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.