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. 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 3 replies
  • 7249 views
  • 8 likes
  • 4 in conversation