BookmarkSubscribeRSS Feed
kamonpan
Calcite | Level 5

Hello

 

        I'm trying to run this code but I'm getting the ERROR: variable .......... not found. Please help Frequency in SAS Studio.

 

CODE

proc freq data=dta ;
table transfusion trans_2gr ;
run;

 

LOG

67 proc freq data=dta ;
68 table transfusion trans_2gr ;
ERROR: Variable TRANSFUSION not found.
ERROR: Variable TRANS_2GR not found.
69 run;

 

 

 

 

2 REPLIES 2
Tom
Super User Tom
Super User

The message seems very clear. Those two variables do not exist in your dataset.

Did you check the variable list?

Are you trying to use the variable LABEL instead of the variable NAME in your code?

Is it possible you have somehow accidentally created a variable name with a space in the middle of it?  If so then to reference it you need to use a name literal.

table 'transfusion trans_2gr'n ;

 

Reeza
Super User

Run a PROC CONTENTS on your dta data set to see the variable names and labels side by side.

 

proc contents data=dta; run;

@kamonpan wrote:

Hello

 

        I'm trying to run this code but I'm getting the ERROR: variable .......... not found. Please help Frequency in SAS Studio.

 

CODE

proc freq data=dta ;
table transfusion trans_2gr ;
run;

 

LOG

67 proc freq data=dta ;
68 table transfusion trans_2gr ;
ERROR: Variable TRANSFUSION not found.
ERROR: Variable TRANS_2GR not found.
69 run;

 


 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 9705 views
  • 0 likes
  • 3 in conversation