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

 

Hi All. I'm trying to run the code below and getting an error saying ERROR: Variable srcLOB is not on file HCGOUT.OUTCLAIMS_xxxx.

 

I don't know why this would be the cases, because I've checked using Proc Contents and the variable does exist. Any idea why this is happening?

 

 


libname hcgout "/sasapps/HCG/HCG_PROD/Data_Sets/Output_NET"; %let list = linenum memberid memberctg incurd_yr_mo hcpcs; %let hcpc = "E0431" "E1390" "E1392" "K0738"; %let loblist = "MCAD" "MCHM"; data hcgTables2014toPresent ; set hcgout.outclaims_2014 (where= (hcpcs in (&hcpc.) and srcLOB in (&loblist.)) keep=&list. rename=(incurd_yr_mo = date)) hcgout.outclaims_2015 (where= (hcpcs in (&hcpc.) and srcLOB in (&loblist.)) keep=&list. rename=(incurd_yr_mo = date)) hcgout.outclaims_prior (where= (hcpcs in (&hcpc.) and srcLOB in (&loblist.)) keep=&list. rename=(incurd_yr_mo = date)) hcgout.outclaims_current (where= (hcpcs in (&hcpc.) and srcLOB in (&loblist.)) keep=&list. rename=(incurd_yr_mo = date)); run;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
It's not in your KEEP list though so you're not bringing it in, even if it is in your original data set.

I think your parenthesis are incorrect as well for your SET - it ends too early with the extra ) after the srcLOB?

View solution in original post

3 REPLIES 3
Reeza
Super User
It's not in your KEEP list though so you're not bringing it in, even if it is in your original data set.

I think your parenthesis are incorrect as well for your SET - it ends too early with the extra ) after the srcLOB?
Kurt_Bremser
Super User

Make it a point to always write dataset options in this order:

  1. keep/drop
  2. rename
  3. where

because that is the sequence in which they are applied by SAS, irrespective of the order in which you write them. That helps to make the code easier to understand and maintain.

Tom
Super User Tom
Super User

@Kurt_Bremser wrote:

Make it a point to always write dataset options in this order:

  1. keep/drop
  2. rename
  3. where

because that is the sequence in which they are applied by SAS, irrespective of the order in which you write them. That helps to make the code easier to understand and maintain.


Note you can remember the order easily because it is alphabetical. Drop,Keep,Rename,Where. 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 6664 views
  • 8 likes
  • 4 in conversation