hi,
i want to change this table that will make one variable with aebodsys as main category and aedecod as subcategories.
like that
VAR |
Cardiac disorder |
atrial flutter |
palpitations |
Tachycardia |
Cardiac failrue |
Psychiatric disorders |
Delirium |
Gastrointestinal disorders |
Constipation |
data AE;
input USUBJID $ 1-3 AEBODSYS $ 5-30 AEDECOD $ 32-49 ;
datalines;
101 Cardiac disorders Atrial flutter
101 Gastrointestinal disorders Constipation
102 Cardiac disorders Cardiac failure
102 Psychiatric disorders Delirium
103 Cardiac disorders Palpitations
103 Cardiac disorders Palpitations
103 Cardiac disorders Tachycardia
run;
thank you for your help
Your data step does not create data similar to your picture. This does:
data AE; infile datalines dlm=','; input USUBJID :$3. AEBODSYS :$30. AEDECOD :$20. ; datalines; 101,Cardiac disorders,Atrial flutter 101,Gastrointestinal disorders,Constipation 102,Cardiac disorders,Cardiac failure 102,Psychiatric disorders,Delirium 103,Cardiac disorders,Palpitations 103,Cardiac disorders,Palpitations 103,Cardiac disorders,Tachycardia run;
Your code was reading from fixed columns. If it worked before you pasted it to the forum you need to know that the main message windows reformat text and will remove repeated blanks and other forms of "white space". So it is best to place code in to a text box opened on the forum as above to keep formatting.
Data almost certainly should stay in the current form for any sort of analysis.
Can you describe how you intend to use that data with all the variable in one column?
If you need groups for analysis or reporting your data may already be as you need.
Example simple report:
Proc tabulate data=AE; Class AEBODSYS AEDECOD ; table AEBODSYS * AEDECOD, n ; run;
Your data step does not create data similar to your picture. This does:
data AE; infile datalines dlm=','; input USUBJID :$3. AEBODSYS :$30. AEDECOD :$20. ; datalines; 101,Cardiac disorders,Atrial flutter 101,Gastrointestinal disorders,Constipation 102,Cardiac disorders,Cardiac failure 102,Psychiatric disorders,Delirium 103,Cardiac disorders,Palpitations 103,Cardiac disorders,Palpitations 103,Cardiac disorders,Tachycardia run;
Your code was reading from fixed columns. If it worked before you pasted it to the forum you need to know that the main message windows reformat text and will remove repeated blanks and other forms of "white space". So it is best to place code in to a text box opened on the forum as above to keep formatting.
Data almost certainly should stay in the current form for any sort of analysis.
Can you describe how you intend to use that data with all the variable in one column?
If you need groups for analysis or reporting your data may already be as you need.
Example simple report:
Proc tabulate data=AE; Class AEBODSYS AEDECOD ; table AEBODSYS * AEDECOD, n ; run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.