Prev: Using a Colon (:) wildcard at beginning of variable lists
Next: Problems with ODS PDF bookmarks in 9.2
From: Ian Whitlock on 12 Jan 2010 19:30 Summary: ALL one-way freqs with all standard variales #iw-value=1 Swamy, I think the term "ALL variables" was confused in the answers. You seem to want all the freq output variables not the freq of all variables in the data set. The answer is simple do the calculations you want or take Toby's advice applied to your variable. However, the latter question is more interesting. Back in the early 90's I asked for FREQ to have the feature of outputing all counts in one file. In reply a procedure was created. It was called FREAKOUT, but to avoid the the standard testing procedures it was not made part of the regular SAS. I thought ODS would be the final answer, but like Mary I found it wanting. Here is some code to give you ideas and another approach. data w ; set sashelp.class (drop=name) ; v + 1 ; height = round(height, 10) ; weight = round(weight, 10) ; run ; proc transpose data = w out = t (drop = v); by v ; var _all_ ; run ; proc freq data = t ; where _name_ ^in ( "v" "Name" ) ; table _name_ * col1 / noprint out = f (drop = percent); run ; data tot ( keep = _name_ tot ) ; set f ; by _name_ ; if first._name_ then tot = 0 ; tot + count ; if last._name_ ; run ; data wanted ; merge f tot ; by _name_ ; if first._name_ then do ; cumcount = 0 ; cumpct = 0 ; end; cumcount + count ; pct = 100 * count / tot ; cumpct + pct ; run ; proc print data = wanted ; run ; Ian Whitlock =============== Date: Tue, 12 Jan 2010 15:06:01 -0500 From: saslearn chicago <sasswamy(a)GMAIL.COM> Subject: PROC Freq - Output All Variables Thanks Art, I could output the result to a data set , but only few fields. Can anyone let me know , whether it is possible to output all the field to a output data set when I tired , I am able to get only the first 3 variable , I wanted the cumulative records and the cumulative percentage ( as it looks in the ouput window ) Do I need to go with a different approach ? Please Advice, - swamy. On Mon, Jan 11, 2010 at 6:18 PM, Arthur Tabachneck <art297(a)netscape.net>wrote: > If you only want frequency and percent then you could use: > > proc freq data=sashelp.class; > weight height; > table age/out=want; > run; > > Otherwise, there is always ODS. > > Art > -------- > On Mon, 11 Jan 2010 18:04:23 -0500, SAS Swamy <sasswamy(a)GMAIL.COM> wrote: > > >Hello, > > > >This might be a simple PROC question , > >By using PROC FREQ, I have got the result I am looking for, but not sure > >how do I output to a data set. > >Do I need to use BY variable , If I need to use OUT=data set name > > > > proc freq data=map1; > > weight cnt; > > table week; > >run; > > > > The FREQ Procedure > > > >Cumulative Cumulative > > Week Frequency Percent Frequency Percent > > > ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ > > 0 4 33.33 4 33.33 > > 1 7 58.33 11 91.67 > > 2 1 8.33 12 100.00 > > > > > >Please Advice. > >Swamy >
First
|
Prev
|
Pages: 1 2 Prev: Using a Colon (:) wildcard at beginning of variable lists Next: Problems with ODS PDF bookmarks in 9.2 |