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!


sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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