To accomplish what I want, I currently filter and sort a column before running a one-way frequency on the same column.
Is it possible to filter, sort, and perform one-way frequency on numerous columns at once?
Here is the SAS STUDIO code: (The column names "rectype" and "delay-rsn" have distinct WHERE conditions.)
data TALL ; set asamtable_2; length _name_ $32 col1 $100 ; _name_='rectype';col1=Rectype; output; _name_='delay_rsn';col1=Delay_Rsn; output; run; proc freq data=TALL; tables _name_*col1 / list ; where (_name_='rectype' and col1 not in ("Brief Initial Screen" "Followup Assessment" "Initial Assessment" )) or (_name_='delay_rsn' and col1 not in ( "Waiting for level of care availability" "Waiting for language-specific services" "Waiting for other special popn-specific svcs" "Hospitalized" "Incarcerated" "Patient preference" "Waiting for ADA accommodation" "Other" )) ; run;
Here's an example of what I did in EG: As you can see, I had to run the code twice, one for each column indicated in SAS Studio. Is there a method to get the frequencies for each columns that have their own unique condition?
Thanks for the help in advance!
@ralizadeh wrote:
To accomplish what I want, I currently filter and sort a column before running a one-way frequency on the same column.
Is it possible to filter, sort, and perform one-way frequency on numerous columns at once?
"I currently filter and sort" ... I understand why someone might want to filter a column before computing one-way frequencies. I don't see a need to sort before computing one-way frequencies.
So please explain what filtering you want to do, and how is this filtering different on each column?
You talk about one-way frequencies, but your SAS code looks like you want a two-way frequency table, as shown in the code below. Please explain.
tables _name_*col1 / list ;
Did you mean transpose only "rectype" and "delay-rsn" variables, then run two-way frequency table, then filter each variables based on their conditions?
Sorry, Reeza; I'm new to EG, so many of the jargons don't make much sense to me yet. With EG, I don't see a two-way frequency option. Is that a different name in EG?
Table Analysis
@ralizadeh wrote:
To accomplish what I want, I currently filter and sort a column before running a one-way frequency on the same column.
Is it possible to filter, sort, and perform one-way frequency on numerous columns at once?
How numerous is "numerous"? Every variable you add is likely going to add some complexity if you insist on a "one code" proc freq.
You have not provided a single reason to do such that really justifies the additional complexity that you are introducing instead of doing multiple proc freq calls.
Note that your 'Import data' is also likely to be a source of problems if you intend to do this repeatedly. Search this forum for Excel Import errors to find many examples.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.