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-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!

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.

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