Desktop productivity for business analysts and programmers

summarising text variables

Reply
N/A
Posts: 0

summarising text variables

Hi. I am trying to create a summary dataset of the following:
var1 var2 var3 var4 var5
var1 is the main variable and vars2-5 contain text values. What I would like is a report that shows the frequencies of var2 values against var1, var3 against var1, etc.

Proc Freq summarised the frequencies nicely one variable at a time BUT there are 50 vars and this method created 50 different datasets which is not practical to work with. Is there a way of doing this in one step and creating only one dataset? I have a feeling Proc Tabulate might do the trick, but I am struggling as I cannot put var2-5 under VAR as they are text fields and classing them with var1 creates a complex cross-matrix that does not give me what I need (unless there is a trick with the syntax in Proc Tabulate). Any ideas?
SAS Super FREQ
Posts: 8,820

Re: summarising text variables

Hi:
Have you tried the LIST option with PROC FREQ?????

[pre]
ods output list=work.freqlist;
proc freq data=sashelp.shoes;
tables region*product product*subsidiary/list;
run;

proc print data=work.freqlist;
run;

[/pre]

The output from this job is too lengthy to show here, but you get a flat list for the first table region*product and then another flat list for product*subsidiary. The information for each crossing is differentiated by a TABLE variable that shows which table statement created the observation. In addition, you can sometimes get the kind of summarizing you want from PROC MEANS. I'm not sure you need TABULATE...although, TABULATE will allow you to nest or cross character variables but you are limited to the N or PCTN statistic.

[pre]

proc tabulate data=sashelp.shoes;
class region product subsidiary;
table region*product,n;
run;
[/pre]

cynthia
N/A
Posts: 0

Re: summarising text variables

Hi Cynthia
The LIST method is what I need! The resulting dataset will need some cleaning up, but this is very much what I was looking for. So simple, thanks.
Cheers, Rob
Ask a Question
Discussion stats
  • 2 replies
  • 116 views
  • 0 likes
  • 2 in conversation