- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
?? 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
?? 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. So "??" is for cleaner log file? when do we need to use "??" instead?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@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.