BookmarkSubscribeRSS Feed
hwangnyc
Quartz | Level 8

Hi everyone,

 

I have a very wide data set. What I want is to create a variable that will indiciate the change from the baseline variable. 

 

What I would like is

If baseline is < any column except baseline and ID then change = Decrease

 

IDBaselineabcbcddsefewbewhgwhjgasdewrcsdasertChange
110......2...5.Decrease
2420....6.....Increase
322.......0..1Decrease
43352.........Increase
50000.........No Change

 

is that possible?

 

Thanks,

 

2 REPLIES 2
Kurt_Bremser
Super User

Define an array over the variables in question.

But you need to review your logical rule. Per your rule as stated, ID's 2 and 4 should be labeled "Decrease".

 


@hwangnyc wrote:

Hi everyone,

 

I have a very wide data set. What I want is to create a variable that will indiciate the change from the baseline variable. 

 

What I would like is

If baseline is < any column except baseline and ID then change = Decrease

 

ID Baseline abc bcd dse few bew hgw hjg asd ewr csd as ert Change
1 10 . . . . . . 2 . . . 5 . Decrease
2 4 2 0 . . . . 6 . . . . . Increase
3 2 2 . . . . . . . 0 . . 1 Decrease
4 3 3 5 2 . . . . . . . . . Increase
5 0 0 0 0 . . . . . . . . . No Change

 

is that possible?

 

Thanks,

 


 

Reeza
Super User

Use MIN to find the lowest values across your variables.

Then compare that to the BASELINE to create your change variable.

 

lowest =min (of abc --ert);
if lowest <= baseline then change='Decrease';
else change='Increase';

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