BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jcis7
Pyrite | Level 9
if 01<code>60 then code_error=1;

G' day!

 


I inherited code that checks the range of a variable, example above.

This variable, code has a length of 2 and is character with leading zeroes: 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, etc.

If a code exists that is 61, then the SAS program identifies it as being >60 and the code_error=1.

 

But, my question is:  is it's a character variable with leading zeroes, how does SAS know whether the variable value is <01 (i.e., 00) or <60? 

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Recommendation:  Fix the code.  It's just plain bad code.  Would you know how SAS would handle these bad data values?

 

"7" (instead of "07")

 

"3A" (instead of "30")

 

It's better to fix the code than to try to think of all the possibilities where the code might give the wrong result.

View solution in original post

2 REPLIES 2
Astounding
PROC Star

Recommendation:  Fix the code.  It's just plain bad code.  Would you know how SAS would handle these bad data values?

 

"7" (instead of "07")

 

"3A" (instead of "30")

 

It's better to fix the code than to try to think of all the possibilities where the code might give the wrong result.

jcis7
Pyrite | Level 9
Got it - Thanks!


hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 1080 views
  • 0 likes
  • 2 in conversation