BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SAS_John
Obsidian | Level 7

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!

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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.

 

View solution in original post

4 REPLIES 4
art297
Opal | Level 21

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

ballardw
Super User

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.

 

SAS_John
Obsidian | Level 7

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

ballardw
Super User

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;

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1467 views
  • 0 likes
  • 3 in conversation