BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
stataq
Quartz | Level 8

Hello,

 

I have a silly question. I saw people use proc format and then build new variable with it.

 

I saw some used 

 

 

Region = put(parkcode, $reglbl.);

 

 

 but some used 

Region=put(parkcode, ??  reglbl.)

what are the difference. I am very confused on '??' part. Could anyone guide me on this?

 

Thanks.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

?? can be used with the INPUT function, not the PUT function.  Consider these variations:

n1 = input('ABC', 3.);
n2 = input('ABC', ?? 3.);

The first statement would give you a message about invalid data being read since the 3. informat looks to create a numeric value.  And "ABC" can't be read as numeric.

 

In a way, the second statement gives the same outcome in that n1 will equal n2.  However, the ?? suppresses any messages in the log about invalid data.

View solution in original post

3 REPLIES 3
Astounding
PROC Star

?? can be used with the INPUT function, not the PUT function.  Consider these variations:

n1 = input('ABC', 3.);
n2 = input('ABC', ?? 3.);

The first statement would give you a message about invalid data being read since the 3. informat looks to create a numeric value.  And "ABC" can't be read as numeric.

 

In a way, the second statement gives the same outcome in that n1 will equal n2.  However, the ?? suppresses any messages in the log about invalid data.

stataq
Quartz | Level 8

Thanks. So "??" is for cleaner log file? when do we need to use "??" instead? 

Tom
Super User Tom
Super User

@stataq wrote:

Thanks. So "??" is for cleaner log file? when do we need to use "??" instead? 


You don't NEED to use it. 

 

You might WANT to use it when:

  • You know that some of the original values might not be valid for the INFORMAT being used.
  • You do not need to distinguish between those original values.  They will be mapped to missing.
  • You do not want the SAS log to display the invalid values.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 416 views
  • 4 likes
  • 3 in conversation