BookmarkSubscribeRSS Feed
jessho
Calcite | Level 5

Hi all, would love help from anyone using SAS enterprise.  Used to code in SAS 9.4 but switched jobs and having trouble now creating new variables in enterprise.

 

Showing code below to create new variable rx_given from existing vartiables rx_code.... any sense of why I keep getting errors that variable does not exist?  Used to work in other version of SAS (only difference is I cannot get into permanent library in enterprise).


data=WORK.PSY;
set work.psy;

If sum (rxcode_1, rxcode_2, rxcode_3, rxcode_4, rxcode_5, rxcode_6, rxcode_7)>0 then rx_given=1;
else rx_given=0;


run;

1 REPLY 1
novinosrin
Tourmaline | Level 20

instead of

data=WORK.PSY;

 

syntax should be

 

data WORK.PSY;

 

Also run a proc contents to determine whether rxcode_1, rxcode_2, rxcode_3, rxcode_4, rxcode_5, rxcode_6, rxcode_7 variables exist

 

The report will show you the metadata contents about the dataset

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 749 views
  • 2 likes
  • 2 in conversation