Date: Tue, 13 Jan 2004 15:42:07 -0500
Reply-To: Sigurd Hermansen <HERMANS1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Sigurd Hermansen <HERMANS1@WESTAT.COM>
Subject: Re: TRANSPOSE and Analysis of the Distribution
Content-Type: text/plain
Dave:
try this form of transpose:
data tPosed;
_name_='Mike';
address='12Street';
col1='Event1';
col2='Event2';
run;
proc transpose data=tPosed out=untPosed;
var col1 col2;
by _name_ address;
run; quit;
A simple SAS SQL GROUP BY query will report the number of events per
address:
select address,count(*) as count
from untPosed
group by address
;
Sig
-----Original Message-----
From: Dave Sorensen [mailto:Dave.Sorensen@JUR.KU.DK]
Sent: Tuesday, January 13, 2004 2:39 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: TRANSPOSE and Analysis of the Distribution
Hi SAS-L,
I have a dataset with 30,958 cases of burglary reported to the police during
a one year period. I am interested in how many burglaries occured at each
unique address. Since my unit of analysis was burglary reports (each of
which contains an addresses), I ran PROC TRANSPOSE so I could find out how
many times each address shows up in the dataset.
So now I have a transposed dataset containing 32 variables: COL1...COL30,
Address, and _Name_.
I'd like to create a variable called "Num_Burgs" (which combines
COL1...COL30) so that I could analyze its distribution and detrmine whether
it is attributable to chance. I presume that requires transposing my data
again. But how? Could someone give me the code?
My dataset has 30,958 burglaries occurring at 29,491 unique residences. Data
from around the world indicate a very skewed distribution for burglary -
where a small proportion of households experience a comparatively large
proportion of all burglaries. But my Danish data don't seem to follow that
trend. Some hand calculations based on the first transpose indicate the
following:
Times This % Experienced this
Burgled of address % of all burglaries
1 95.5% 91.0%
2 4.11 7.82
3 0.28 0.80
3 to 30 0.07 0.36
Thanks,
Dave S., cross-eyed at
U of Copenhagen