For example, a variable LABCAT has values like "Hematology", "Chemical", "Urinalysis"..... and variable lab parameter PARAM has values like "WBC", "RBC", "BASOPHILS", ...so on like 100. I have 100 values for PARAM.
Example Look-up Table:
PARAMN PARAM PARAMCD ATYPE LBCAT LBTESTCD
1 Potassium)mmol/L) K num CHEMISTRY K
2 Albumin(g/L) ALB num CHEMISTRY ALB
3 Creatinine(umol/L) CREAT num CHEMISTRY CREAT
4 Basophils(10^9L) BASO num HEMATOLOGY BASO
5 Prothrobin Time PT num HEMATOLOGY PT
6 Color COLOR char URINALYSIS COLOR
7 pH PH char URINALYSIS PH
.........
.
.
.
How do I create macro where it directly takes the PARAM values for 100 different values automatically and creates the output table. In simple, I want to create a macro in such a way that I want to call that macro and I should get all the 100 outputs/ reports/ tables.
For your reference I am also attaching a mock table output that I want for 100 tables.
Please let me know if you need any additional information.
1) Suppose you have just one PARAM. Can you writ a program to create a report as wanted?
2) You don't need a macro; just create the report BY PARAM.
3) You did not supply the full observation info - you miss numeric values to be used in the
report. What is XX ?
1) Suppose you have just one PARAM. Can you writ a program to create a report as wanted?
2) You don't need a macro; just create the report BY PARAM.
3) You did not supply the full observation info - you miss numeric values to be used in the
report. What is XX ?
UCLA introductory tutorial on macro variables and macros
https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/
Tutorial on converting a working program to a macro
This method is pretty robust and helps prevent errors and makes it much easier to debug your code. Obviously biased, because I wrote it 🙂 https://github.com/statgeek/SAS-Tutorials/blob/master/Turning%20a%20program%20into%20a%20macro.md
Examples of common macro usage
https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Ap...
Your question is too generic, please provide more details.
@RAVI2000 wrote:
For example, a variable LABCAT has values like "Hematology", "Chemical", "Urinalysis"..... and variable lab parameter PARAM has values like "WBC", "RBC", "BASOPHILS", ...so on like 100. I have 100 values for PARAM.
Example Look-up Table:
PARAMN PARAM PARAMCD ATYPE LBCAT LBTESTCD
1 Potassium)mmol/L) K num CHEMISTRY K
2 Albumin(g/L) ALB num CHEMISTRY ALB
3 Creatinine(umol/L) CREAT num CHEMISTRY CREAT
4 Basophils(10^9L) BASO num HEMATOLOGY BASO
5 Prothrobin Time PT num HEMATOLOGY PT
6 Color COLOR char URINALYSIS COLOR
7 pH PH char URINALYSIS PH
.........
.
.
.
How do I create macro where it directly takes the PARAM values for 100 different values automatically and creates the output table. In simple, I want to create a macro in such a way that I want to call that macro and I should get all the 100 outputs/ reports/ tables.
For your reference I am also attaching a mock table output that I want for 100 tables.
Please let me know if you need any additional information.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.