BookmarkSubscribeRSS Feed
Nasya
Obsidian | Level 7

Hi,

I am trying to write a code where the output has to displayed as per the footnotes which are given below.

(1) I = age >=55; II = non-smoking, no CAD;

(2) 1 = age>55,no CAD; 2= no death;

 

ID is the unique variable.

SLCT and SLCT1 are Char variables which are converted to Numeric.

Any help in suggesting where the code has to corrected is appreciated.

Thank you.

 

data step_01;
     set incl;
     by ID;
attrib SLCT_  SLCT1_length= 5;

/*Footnote (1)*/

      if SLCT= 'age>=55' then SLCT_=I;
      else if SLCT='non-smoking,no CAD' then SLCT_=II;
      
/*Footnote (2)*/

       if SLCT1= 'age>55,no CAD' then SLCT1_= 1;
       else if SLCT1='no death' then SLCT1_=2;
run;

Regards,

Nasya

2 REPLIES 2
ballardw
Super User

You are creating variables but I am not sure of the connection to "footnotes". In SAS Footnote usually refers to a Footnote statement which places text after the output of a procedure such as:

Title "This is a title to place at the top of output";
Footnote "Only 5 observations were selected for printing";
proc print data=sashelp.class (obs=5);
run;
/* turn off title and footnote*/
title; footnote;

Since you do not show how you are creating any output other than a data set you will need to provide more example of what you want.

 

 

This statement assigns the value of the variable I to SLCT_. Is that the desired action?

if SLCT= 'age>=55' then SLCT_=I;

Nasya
Obsidian | Level 7
Hi ballardw,
Thank you for your response. I am not sure if that is a desired action, but I was trying to see if that will help me display the output as desired.

Below is how the dataset appears:

ID Case1 Case2
001 age >=55 age>55,no CAD
002 age >=55 no death
003 non-smoking, no CAD no death
004 non-smoking, no CAD age>55,no CAD

ID(Variable is ID)- Character
Case1(Variable is SLCT)- Character
Case2(Variable is SLCT1)- Character

Output Desired:
Foot notes:(1) I = age >=55; II = non-smoking, no CAD;(2) 1 = age>55,no CAD; 2= no death;

ID Case1 Case2
001 I 1
002 I 2
003 II 2
004 II 1

Will this information help you to understand what is expected? I appreciate your help.

Thank you,

Regards,
Nasya

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

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