BookmarkSubscribeRSS Feed
Sasy9873
Calcite | Level 5

{Urgent} I am fairly new to SAS and have two questions. 

 

First, I am trying to run this code. Would I need to run the data temp;set EHdata.ARCHdata; line with the other code I've written everytime> Because, when I do not, I get this error message:

 

Screenshot (1).png

 

Second, I am trying to create this new variable ANCComplication using categorical variables that already exist in my dataset. Here is the code I've written:

 

 

 

Screenshot (2).png

However, when I run a proc freq of ANCComplication, I get this: Screenshot (3).png

 

Let me know what I am doing wrong for both of these problems! Thank you! 

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Hi and welcome to the SAS Communities 🙂

 

Can you please post your code using the little running man instead of posting it as images? Makes it much easier to provide a usable answer.

Kurt_Bremser
Super User

For your first question: "if" is a data step statement and works only inside a data step; the "run;" right before your if's constitutes a "step boundary", meaning the previous step is finished and you need to start a new one. Or if you did not want the previous step to finish yet, remove that run.

I recommend that you work through the free online Programming 1 course, where such issues are covered.

 

Please post code using the "little running man" icon.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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