Hello,
I am having difficultly achieving the following objective when given an excel data file. I have started the code below, but cannot produce an output.
Objective using Macros:
From each of the 5 clinics (inst_num) randomly select 5 AML patients, 10 CML patients, 20 ALL patients, and 5 CLL patients (leu_type). If there are less than 5 AML patients then select all of them, if there are less than 10 CML patients then select all of them, if there are less than 20 ALL patients then select all of them, and if there are 5 CLL patients then select all of them.
Then find cross-tabulation of Leu_type and inst_num. Additionally, print final dataset.
Is this a homework assignment? Because this thread works on almost the exact same data and the exact same variable names.
But, you don't need macros to do this. Assign a random number to each group, sort and then take the top 5 (or top 10, or top 20) etc to randomly select.
Is this a homework assignment? Because this thread works on almost the exact same data and the exact same variable names.
But, you don't need macros to do this. Assign a random number to each group, sort and then take the top 5 (or top 10, or top 20) etc to randomly select.
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.
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.