BookmarkSubscribeRSS Feed
aniketwagare0
Fluorite | Level 6

I am runing following code,

 

libname orionx XLSX "/home/aniketwagare0/test/ecprg193/lpar.xlsx"
libname outori "/home/aniketwagare0/test/output"

data outori.tetest
set orionx.lpar1
where Action Performed='111 Create an account' and Action Performed='109 Subscribe Email'
run

 

But i am getting following error,

 

57 data outori.tetest;
58 set orionx.lpar1;
59 where Action_Performed='111 Create an account' and Action_Performed='109 Subscribe Email'
ERROR: Variable Action_Performed is not on file ORIONX.lpar1.
60 run;
 
 
I have attached my xlsx file.
3 REPLIES 3
ballardw
Super User

Check your spelling. Make sure the variable you reference is the same. I will bet that there is no _ in the name of the variables (or a space either)

Reeza
Super User

Your condition will never be true. 

 

If one portion is true the other will not be true. 

 

Perhaps you mean OR instead of AND?

 

You can also use IN

 

where actionPerformed in ('match1' , 'match2', 'match3');

Kurt_Bremser
Super User

This

ERROR: Variable Action_Performed is not on file ORIONX.lpar1.

tells the whole story. You mistyped the variable name.

Before working with Excel files through SAS, one should make sure that the header lines in the sheets (which are used to create variable names) adhere to SAS naming standards.

I'd rather import the Excel data into SAS (preferably by saving to a proper file format like csv from Excel) and deal with issues there.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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