Date: Thu, 26 Jul 2001 13:38:11 -0400
Reply-To: Jonathan Siegel <Jonathan.Siegel@PFIZER.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jonathan Siegel <Jonathan.Siegel@PFIZER.COM>
Subject: Re: How to read this?
Perhaps it depends on how things are being used.
Industrial-strength datasets that will last a long time and need to be
accessed by strangers should have good metadata, and have that metadata
well documented. But not everyone needs all this. I've seen a tendency in
IT circles to think there's a "right" way to do these things; in reality
how much is needed depends on the purpose.
Since I think everyone will agree that not everyone needs an audit trail
and most will have applications where integrity constraints actually get in
the way, it's just a matter of degree to find the case that doesn't need
labels or formats. For many graduate students, quick-and-dirty market
research studies, and many others, SAS datasets only exist for a brief time
between the raw files and the final product. For these folks, the raw file,
program documentation, and final output documentation is probably all
that's needed, and prettying up the SAS datasets or writing up a data
dictionary on them would probably would be a waste of time. It's not that
their use of SAS is unprofessional; it's that the benefit they gain from
the extra documentation doesn't justify the cost. A professional could work
in either context and know how much documentation is appropriate based on
the user's need.
Jonathan Siegel
On Wed, 25 Jul 2001 08:17:46 -0400, Howard Schreier
<howard_schreier@ITA.DOC.GOV> wrote:
>The basic problem is that a mere list of variable names does not constitute
>a data dictionary. The latter would provide information on data types,
>appropriate informats/formats, and more.
>
>For example, I would want to store MONTH as a numeric using the SAS date
>conventions.
>
>If the names come from a closed set of possibilities, it should be possible
>to build such a dictionary. An alternative would be to code decision rules
>based on the names encountered.
>
>I would begin by outlining everything that is known about the possible
names
>and the characteristics of the associated data.
>
>On Tue, 24 Jul 2001 13:26:08 -0700, Huang, Ya <ya.huang@AGOURON.COM> wrote:
>
>>Assuming that all your var are numeric.
>>
>>data xx;
>>infile cards truncover firstobs=1 obs=1;
>>input varname $ 200.;
>>call symput('vlist',varname);
>>cards;
>>MONTH CPI
>>198001 10
>>198002 9
>>;
>>
>>options nocenter formdlim=' ';
>>
>>proc print;
>>run;
>>
>>%put &vlist;
>>
>>data yy;
>>infile cards firstobs=2;
>>input &vlist;
>>cards;
>>MONTH CPI
>>198001 10
>>198002 9
>>;
>>
>>proc print;
>>run;
>>
>>------------------------------
>>
>>The SAS System 12:57 Tuesday, July 24, 2001 17
>>
>>Obs varname
>>
>> 1 MONTH CPI
>>
>>
>>
>>The SAS System 12:57 Tuesday, July 24, 2001 18
>>
>>Obs MONTH CPI
>>
>> 1 198001 10
>> 2 198002 9
>>
>>First data step generate a var list (macro var),
>>second data step use it for input statment.
>>This way, you don't have to know how many vars before hand.
>>
>>If you want to read them in as all character, you need to
>>do something in the first data step before call symput.
>>Basically, you need a do loop to scan the word, then
>>concatenate them with '$' in between.
>>
>>If you want to read them as mixture of char and num,
>>sorry, I don't know.
>>
>>HTH
>>
>>Ya Huang
>>
>>
>>> -----Original Message-----
>>> From: wong [mailto:brm2001@HONGKONG.COM]
>>> Sent: Tuesday, July 24, 2001 2:07 AM
>>> To: SAS-L@LISTSERV.UGA.EDU
>>> Subject: How to read this?
>>>
>>>
>>> Hi,
>>>
>>> Suppose I have the following datafile.
>>>
>>> ===
>>> MONTH CPI
>>> 198001 10
>>> 198002 9
>>> ===
>>>
>>> As above, my datafile already contains the variable names "MONTH" and
>>> "CPI" (the first row of my datafile). How can I tell the SAS system to
>>> read variable names from the datafile itself so I do not need to type
>>> the "variable name" again in my SAS program?
>>>
>>> Best,
>>> Wong
>>>
>>
|