LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 22 Dec 2004 00:49:30 +0000
Reply-To:     iw1junk@COMCAST.NET
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ian Whitlock <iw1junk@COMCAST.NET>
Subject:      Re: Proc Freq
Comments: cc: Mathew Chandler <mchandle@UWINDSOR.CA>

Mathew,

1) NOPERCENT supresses the percentage column in the report not in the output file. Look at

data w ; do x = 1 to 5 ; output ; end ; run ; proc freq data = w ; table x / out = f(drop=percent) ; run ;

2) Here is a quick and dirty approach to the problem to consider. (Thanks to somebody on SAS-L sometime in the last few years.)

/* create data */ data w ; do obs = 1 to 10 ; x = ceil ( 3 * ranuni ( 54523 ) ) ; y = mod ( x , 2 ) ; z = scan ( "abc def ghi" , x ) ; output ; end ; run ;

/* massage for cross tab */ proc transpose data = w out = t (where = ( _name_ ^= "obs" ) ); by obs ; var _all_ ; run ;

/* do the cross tab */ proc freq data = t ; table _name_ * col1 / out = freq ( drop = percent ) ; run ;

3) Continuing the example

/* transfer to csv file */ filename csv temp ; data _null_ ; set freq ; file csv dsd ; put (_all_) (:) ; run ;

/* check result */ data _null_ ; infile csv ; input line $char50. ; put line ; run ;

If you want a different delimiter then use

file csv dsd dlm = "?" ;

where "?" indicates a quoted single character of your choice. (Use "09"x for tab on ASCII systems.)

Ian_Whitlock@comcast.net ============================ Date: Tue, 21 Dec 2004 16:27:21 EST Reply-To: mchandle@UWINDSOR.CA Sender: "SAS(r) Discussion" From: Mathew Chandler <mchandle@UWINDSOR.CA> Subject: Proc Freq In-Reply-To: <OF7E8202AC.9D83D117- ON85256F40.00717F0F-85256F40.00725267@LocalDomain> Content-Type: text/plain; charset=US-ASCII Proc Freq data=SETeval noprint; by ID Prof Rubric Enroll; Tables Rubric / nocum nopercent out=data1; Proc Freq data=SETeval noprint; by ID Prof Faculty Rubric Enroll; tables A1-A9 An10-An12 B1-B9 Bn10-Bn15 D1-D9 Dn10-Dn12 / Out=data2 nocum nopercent; A number of questions: 1. Can seem to supress the percentages. I thought that nopercent was supposed to do this, but it is not. 2. How do I get the second PRoc Freq to output all of the frequencies to the table and not just the last (Dn12)? Or do I have to do each frequency with a separate proc and then merge them? 3. The ultimate objective is to produce a data file that is comma delimited or delimited with another character between fields. Can SAS do this, once the dataset is created? Mathew Chandler Associate Computing Consultant-Client Support & Services I.T. Services University of Windsor Windsor, Ontario, Canada N9B 3P4 (519) 253-3000 ext. 2768 mchandle@uwindsor.ca


Back to: Top of message | Previous page | Main SAS-L page