Date: Tue, 1 Mar 2011 18:56:15 -0500
Reply-To: Tom Abernathy <tom.abernathy@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Tom Abernathy <tom.abernathy@GMAIL.COM>
Subject: Re: proc contents
I am not sure why this is difficult.
proc contents data=spssfile noprint out=contents;
run;
data _null_;
set contents;
put name @;
run;
Of course now that you have them in a dataset you can sort them. You can
parse the names or the labels to identify which rater they represent.
On Tue, 1 Mar 2011 17:33:23 -0600, Swank, Paul R <Paul.R.Swank@UTH.TMC.EDU>
wrote:
>I have a multivariate data set with 12749 variables. Several hundred of
these variables represent observations done by 2 raters on two occasions. So
there are four observations on each variable. I need to do a reliability
with rater and occasion as facets of the measurement model. I use varcomp of
mixed to get the variance components to use in computing intraclass
correlations. The data has to be in univariate format. The variable names
and there order in the data step are such that there is no way to specify a
range of variables so each variable has to be typed out. I am lazy, number
1, and a poor typist number 2. I usually do a proc contents short to list
the variable names to my output file. Then I copy them into the program and
I can just copy and paste them into the steps I need to do. It saves a lot
of typing and also cuts down on errors of mistyping the variable name.
However, it seems that "proc contents short" has a limit on the number of
variables it will print. Proc contents itself does not seem to but it lists
all the variable names in a column along with labels and other stuff. Not
very convenient for cutting and pasting hundreds of variable names. So I was
hoping there was some way to get the list of the variable names that goes
across the page rather than just down. But it appears that using the data
definition method with proc sql has the same limitation as proc contents
short. SO I am left with typing out all these variable names into a list so
I can format the data the way I want. I have never had to do this with such
a large data set and surprised to find that proc contents short does not
work in this case. That's it in a nutshell.
>
>Paul
>
>Dr. Paul R. Swank,
>Professor and Director of Research
>Children's Learning Institute
>University of Texas Health Science Center-Houston
>
>From: Joe Matise [mailto:snoopy369@gmail.com]
>Sent: Tuesday, March 01, 2011 5:04 PM
>To: Swank, Paul R
>Cc: SAS-L@listserv.uga.edu
>Subject: Re: proc contents
>
>Paul, what are you actually trying to do? I do hope it's not "make a keep
list with 12000 variables written out in my code", if so you should use a
macro variable with SELECT INTO (well, or a dataset written out into a text
file, depending on whether the list is over the length limitation, I think
64k charcters if I recall correctly).
>
>If it's not that, then what are you doing with it? Odds are you can use
some sort of programmatic code to do whatever it is either using PROC
CONTENTS output to a dataset or DICTIONARY.TABLES (which is essentially the
table equivalent of PROC CONTENTS).
>
>Also, SPSS should be able to give you the same list, in html or excel
format. I have had to do that before in order to deal with name shortening
...
>
>-Joe
>On Tue, Mar 1, 2011 at 4:34 PM, Swank, Paul R
<Paul.R.Swank@uth.tmc.edu<mailto:Paul.R.Swank@uth.tmc.edu>> wrote:
>Someone who shall remain nameless has sent me an SPSS data set of over
12000 variables. After finally getting it converted to a .por file and
bringing it into SAS I want to get a short list of the variable names so I
can cut and paste them in my program. None of the filenames make any sense
and are not ordered to make it easy to specify ranges of variables. I
usually do this with "proc contents short;" However, while "proc contents;"
will list the entire set of variable names with labels etc to the output
window, "proc contents short;" will not. It truncates the list of variables.
Does anyone have a clue how I can get around this problem. I'm trying not to
have to type hundreds of variable names in my program nor copy and paste
them one at a time.
>
>Dr. Paul R. Swank,
>Professor and Director of Research
>Children's Learning Institute
>University of Texas Health Science Center-Houston
|