LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (July 2010, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 21 Jul 2010 12:46:06 -0700
Reply-To:     Dale McLerran <stringplayer_2@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Dale McLerran <stringplayer_2@YAHOO.COM>
Subject:      Re: summary statistics of all variables
In-Reply-To:  <201007211902.o6LGcEfr013674@willow.cc.uga.edu>
Content-Type: text/plain; charset=us-ascii

The presentation that PROC MEANS directs to the output window can be generated to an ascii file by using PROC PRINTTO. It is then a matter of reading the ascii file and parsing the records to determine where the actual data begin and end. I submitted the following code and obtained the desired results.

/* Route output to an ascii file */ proc printto print="c:\temp\sumstats.lst"; run;

/* Request statistics employing PROC MEANS */ options formchar='-'; proc means data=test2 nmiss n min max; var _numeric_; run;

/* Reset output to the default location */ proc printto; run;

/* Parse the ascii file employing the following steps */ data sumstats; length vname $ 32 line $ 200; infile "c:\temp\sumstats.lst" length=linelen end=lastrec; input _tmp $char1. @; input @1 line $varying200. linelen; if left(line)=:"-----" then do until(lastrec); input _tmp $char1. @; input @1 line2 $varying200. linelen @; if left(line2)^=:"-----" then do; input @1 vname nmiss n min max; output; end; end; keep vname nmiss n min max; run;

/* Print the data set which contains the summary statistics */ proc print data=sumstats; run;

That we cannot get the statistics in a vertical file directly is a real pain in the patootie.

Dale

--------------------------------------- Dale McLerran Fred Hutchinson Cancer Research Center mailto: dmclerra@NO_SPAMfhcrc.org Ph: (206) 667-2926 Fax: (206) 667-5977 ---------------------------------------

--- On Wed, 7/21/10, Ya Huang <ya.huang@AMYLIN.COM> wrote:

> From: Ya Huang <ya.huang@AMYLIN.COM> > Subject: Re: summary statistics of all variables > To: SAS-L@LISTSERV.UGA.EDU > Date: Wednesday, July 21, 2010, 12:02 PM > Mike, > > "The only issue is that the data set is as linear as any > made-for-TV movie." > that is exactly why _null_, another Mike and me are trying > to avoid. > We all trying to work out a solution that a vertical > dataset can be > created without doing many other steps, such as transpose > etc. > > Ya


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