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.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 789 views
  • 4 likes
  • 3 in conversation