BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
luigipugliese
Calcite | Level 5

Hi guys,

I am having a problem with a simple code. I am trying to use the if then else syntax but I feel like the else part is not been taken into account by SAS Studio. Here is the code: 

 

data WORK.HEART_plus;
set WORK.HEART_complete;
if AgeCDHdiag = . then cat_AgeCDHdiag=0;
else cat_AgeCDHdiag=1;
run;

 

The WORK.HEART_complete table comes from filtering the missing values of the smoking, weight, and cholesterol variables from the HEART table. 

1 ACCEPTED SOLUTION

Accepted Solutions
4 REPLIES 4
Reeza
Super User

@luigipugliese wrote:

Hi guys,

 

I'm not a guy so I guess I shouldn't answer your question?

 

Check your log, there's likely a note about an variable not being initialized which points to a typo error. If not, post your full code and log. 

 


@luigipugliese wrote:

Hi guys,

I am having a problem with a simple code. I am trying to use the if then else syntax but I feel like the else part is not been taken into account by SAS Studio. Here is the code: 

 

data WORK.HEART_plus;
set WORK.HEART_complete;
if AgeCDHdiag = . then cat_AgeCDHdiag=0;
else cat_AgeCDHdiag=1;
run;

 

The WORK.HEART_complete table comes from filtering the missing values of the smoking, weight, and cholesterol variables from the HEART table. 


 

luigipugliese
Calcite | Level 5
sorry, just wanted to say hi in a general way. thanks for the reply.
luigipugliese
Calcite | Level 5

what does it mean when a variable is uninitialized? I think that is the only relevant note from the LOG.

 

thanks in advance.

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

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