Date: Tue, 21 Sep 1999 08:45:35 -0400
Reply-To: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject: Re: Read a transpose dataset
Content-Type: text/plain; charset=US-ASCII
There have been a number of suggestions made, and while I don't
recall having disagreement with any, it seems that most were
either a bit convoluted, or else sidestepped the tricky parts.
How about allowing for an unlikely large number of individuals,
exploiting MISSOVER behavior to generate the implied missing values,
then using a WHERE filter to get rid of them.
I put the test data into file WIDE.TXT then ran the following:
infile 'wide.txt' dsd lrecl=32000 missover;
input @2 _name_$ (val1-val4000)(:$20.);
proc transpose data=wide
out=long(drop=_name_ where=(NAME||COUNTRY||STUid ne ' '));
proc print; run;
This should handle up to 4000 cases with up to 20 characters in
It's trickier if there is numeric data involved.
> Hi all,
> I would like to know how to read a transpose dataset in SAS. The
> datafile is as follow:
> All the fields are separate with comma. And I hope to read in a dataset
> like this:
> NAME COUNTRY STUid
> JOHN US 5647
> PETER UK 5654
> MARY JAPAN 5421
> I cannot use the EXCEL to transpose before readin because there are many
> people in the dataset. The excel cannot load the whole file.
> Please give suggestions. Thank you very much.