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,
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,
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';
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.