Hi,
I am reading other people's code but did not understand "??" in the following code for char into num conversion. input(strip(AESTDTC),?? yymmdd10.)
Can somebody help me out on this?
Thanks!
Please the log when you run this example code:
data example; mydate = input('9999/99/99', yymmdd10.) ; odate = input('9999/99/99',?? yymmdd10.) ; realdt = input('2017/10/05', yymmdd10.) ; format mydate odate realdt date9.; run;
You will get an error message from the first line. The example "dates" of 9999/99/99 are one example of some coding for "missing" in some data systems that must have a value but for some reason do not have the actual value available.
The ?? in the input statement will result in a missing value (with no note in the log) when the variable can't be input using the specified informat.
Art, CEO, AnalystFinder.com
Please the log when you run this example code:
data example; mydate = input('9999/99/99', yymmdd10.) ; odate = input('9999/99/99',?? yymmdd10.) ; realdt = input('2017/10/05', yymmdd10.) ; format mydate odate realdt date9.; run;
You will get an error message from the first line. The example "dates" of 9999/99/99 are one example of some coding for "missing" in some data systems that must have a value but for some reason do not have the actual value available.
Thank you both!
From the result, the day missing values are the first day of the month. Is anyway to define the missing values of both day and month similarly?
Best,
John
It will help to show us what the values with missing days look like. If your dates actually have delimiter such as / then the ANYDTDTE informat should work to imply the day of the month when missing is 01.
data example; informat datestr $10.; input datestr ; mydate = input(datestr,anydtdte.); format mydate date9.; datalines ; 2017/01/15 2017/01 ; run;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.