| Date: | Sun, 9 Sep 2007 22:16:50 -0700 |
| Reply-To: | David L Cassell <davidlcassell@MSN.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | David L Cassell <davidlcassell@MSN.COM> |
| Subject: | Re: KDE Question |
| In-Reply-To: | <200709082318.l88AkPfT021336@mailgw.cc.uga.edu> |
| Content-Type: | text/plain; format=flowed |
|---|
EvilPettingZoo97@AOL.COM replied:
>On Sat, 8 Sep 2007 20:09:00 -0000, jason.s.turner@GMAIL.COM wrote:
>
> >Hi, I am fairly new to SAS and have ran into a little trouble. My
> >initial dataset consited of grades (4,3,2,1) and majors. EX:
> >
> >2 ACCOUNTING
> >3 ACCOUNTING
> >4 ACCOUNTING
> >
> >I want to generate a KDE graph of a range of 0 to 4 on the y axis and
> >with the majors on the x axis. To do this I did a Proc Means on the
> >grade (by major) and got a dataset like this:
> >
> >ACCOUNTING 2.952293578
> >AG BIOTECH 2.7075471698
> >AG ECON 1.9034482759
> >AG EDUC 2.0147058824
> >
> >The problems I am having are #1 when I run Proc KDE, I get no graph
> >and #2 all of the charts that come up are per major (when I eventually
> >get a graph, I want it all lines for all majors on one graph).
> >
> >This is my code:
> >
> >proc sort data = sasuser.impw_0000 out = ukmathsort;
> > by major;
> >run;
> >
> >proc means data = ukmathsort mean;
> > var grade;
> > by major;
> > output out = ukmathmeans MEAN = meangrade;
> >run;
> >
> >proc kde data=ukmathmeans;
> > univar meangrade/gridl=0 gridu=25 out=kdemath;
> >run;
> >
> >
> >Thanks,
> >
> >Jason
>
>
>Jason,
>
>If you have grades with just four values, then I don't think you want a
>density plot. These are 'smoothed histograms' of continuously measured
>parameters. You can do it, but it may not be appropriate.
>
>To get a graph, invoke the ODS Statistical Graphics that became available
>in V9.
>
>Below is some sample code:
>
>data scores ;
> do major=1 to 50 ;
> do _n_=1 to 40 ;
> grade=round( ( ranuni( 90210 )*100 )/ 25 ) ;
> output ;
> end ;
> end ;
> stop ;
> run ;
>
>ods graphics on ;
>ods rtf file="%sysfunc(pathname(work))\junk.rtf" style=journal ;
>
> proc kde data=scores ;
> univar grade / plots=hisdensity ;
> run ;
>
>ods rtf close ;
>
>
>If the stats peeps disagree and think creating densities for discrete
>values
>is OK, see a previous post that generates overlayed density plots with the
>Graphics Template Language (GTL)
>http://listserv.uga.edu/cgi-bin/wa?A2=ind0605D&L=sas-l&P=R8878
>
>HTH,
>Ken
The 'stats peeps', huh? I'll check and see if my stats homeys wanna put
a cap in your survivor function. :-) :-)
I agree with you. I think that Jason would benefit greatly from
explaining what he is *really* trying to do with these data. At that
point, someone here is more likely to be able to point him in a better
direction.
HTCT,
David
--
David L. Cassell
mathematical statistician
Design Pathways
3115 NW Norwood Pl.
Corvallis OR 97330
_________________________________________________________________
Discover sweet stuff waiting for you at the Messenger Cafe. Claim your
treat today!
http://www.cafemessenger.com/info/info_sweetstuff.html?ocid=TXT_TAGHM_SeptHMtagline2
|