Hello everyone, I'm migrating from SAS to SPSS. It's fine for most of
the functions I use from SAS, but there are some SAS functions which I
miss greatly. I'm hoping someone may know the an simple equivalent in
SPSS.
1. Capture output from basic statistics procedures such as means /
frequencies
In SAS, the Proc functions (Proc Means, Proc Univariate etc) include
the option to output to a dataset. In SPSS, is there an easier
alternative to OMS? OMS requires more steps in terms of knowing the
labels of the tables, and additional syntax. SAS's Proc means also
allow very fine control of the percentiles to output, eg.
Proc means data=dataset;
output out=percentile_table pctlpre = p pctlpts = 1 to 100 by 1;
run;
I wasn't able to find something similar in SPSS.
2. Proc sql's select into feature :
eg.
proc sql;
select var1, count(*) as n into :a separated by " ", :b separated by "
"
from dataset
group by var1;
quit;
In SPSS, I would generate the respective statistics, then oms to
output to a text file or spss dataset, and perform further table
transformations to extract the individual components. I'm hoping
there's a shorter way of achieving the "select into" function.
3. Iteratively processing delimited list, in sas :
%let delimited_list = var1 var2 var3;
%let counter = 1;
%do %until (%scan(&delimited_list, &counter, " ") eq ));
----SOME SAS FUNCTIONS to process var1 to var3
%end;
I haven't found an alternative for SPSS.
4. Referring to all Character or Numeric variables
SAS has _ALL_, _NUMERIC_ and _CHARACTER_ keywords, which makes it easy
to work with many variables such as :
Proc univariate data=dataset;
var _NUMERIC_;
run;
This generates univariate statistics for all numeric variables. In
SPSS, I wasn't able to find a similar keyword.
Thanks in advance for your attention!
|
|
0
|
|
|
|
Reply
|
perizen1 (1)
|
3/17/2010 11:42:51 AM |
|
On Mar 17, 5:42=A0am, zen <periz...@gmail.com> wrote:
> Hello everyone, I'm migrating from SAS to SPSS. It's fine for most of
> the functions I use from SAS, but there are some SAS functions which I
> miss greatly. I'm hoping someone may know the an simple equivalent in
> SPSS.
>
> 1. Capture output from basic statistics procedures such as =A0means /
> frequencies
> In SAS, the Proc functions (Proc Means, Proc Univariate etc) =A0include
> the option to output to a dataset. In SPSS, is there an easier
> alternative to OMS? OMS requires more steps in terms of knowing the
> labels of the tables, and additional syntax. SAS's Proc means also
> allow very fine control of the percentiles to output, eg.
> Proc means data=3Ddataset;
> output out=3Dpercentile_table pctlpre =3D p pctlpts =3D 1 to 100 by 1;
> run;
>
> I wasn't able to find something similar in SPSS.
>>>OMS is the general mechanism. You only need the subtable types, not the=
labels.
oms select tables /if subtypes=3D"'Descriptive Statistics'
/destination outfile=3Dstats format=3Dsav.
desc ...
omsend.
Some commands include special direct to dataset features, but only OMS
is completely general. If you use Python programmability,
you can simplify this further:
begin program.
import spss, spssaux
spssaux.CreateDatasetOutput("desc x y z", subtype=3D"Descriptive
Statistics")
end program.
That function wraps the syntax in the appropriate OMS directives for
you.
>
> 2. Proc sql's select into feature :
> eg.
> proc sql;
> select var1, count(*) as n into :a separated by " ", :b separated by "
> "
> from dataset
> group by var1;
> quit;
>
> In SPSS, I would generate the respective statistics, then oms to
> output to a text file or spss dataset, and perform further table
> transformations to extract the individual components. I'm hoping
> there's a shorter way of achieving the "select into" function.
>>>Not sure exactly what you want here, but look at AGGREGATE
>
> 3. Iteratively processing delimited list, in sas :
> %let delimited_list =3D var1 var2 var3;
> %let counter =3D 1;
> %do %until (%scan(&delimited_list, &counter, " ") eq ));
> =A0 ----SOME SAS FUNCTIONS to process var1 to var3
> %end;
>
> I haven't found an alternative for SPSS.
>>>DO REPEAT might do what you need here. More elaborate things can, again=
, be done with programmability.
>
> 4. Referring to all Character or Numeric variables
> SAS has _ALL_, _NUMERIC_ and _CHARACTER_ keywords, which makes it easy
> to work with many variables such as :
> Proc univariate data=3Ddataset;
> var _NUMERIC_;
> run;
> This generates univariate statistics for all numeric variables. In
> SPSS, I wasn't able to find a similar keyword.
>>>SPSS doesn't have equivalent keywords, but, again, programmability can d=
o this:
begin program.
numericvars =3D spssaux.VariableDict(variableType=3D"numeric").variables
spss.Submit("desc %s" % " ".join(variables))
end program.
For reuse in regular syntax, the program could generate a macro
instead. E.g.
begin program.
import spss, spssaux
numericvars =3D spssaux.VariableDict(variableType=3D"numeric").variables
spss.SetMacroValue("!numeric", " ".join(numericvars))
end program.
desc !numeric.
The VariableDict class can filter on many other criteria as well.
HTH,
Jon Peck
>
> Thanks in advance for your attention!
|
|
0
|
|
|
|
Reply
|
JKPeck
|
3/17/2010 1:35:24 PM
|
|
In SPSS there are often many ways to do things. In addition to what Jon
said see
LOOP
and
I don't know if every variable list can take ALL as an argument but
certainly many do. To deal with just numeric or string variables see
SORT VARIABLES after which you could use the TO convention.
DATASET ACTIVATE DataSet1.
display dictionary.
SORT VARIABLES BY type (A).
display dictionary.
Jon mentioned that many procedures have direct to dataset options, some
examples off the top of my head are DESCRIPTIVES, CROSSTABS,
PROXIMITIES, FACTOR, REGRESSION, QUICK CLUSTER, TWOSTEP, DISCRIMINANT,
AGGREGATE, CORRELATIONS, MATRIX, ONEWAY, REPORT, UNIANOVA, GLM, GENLIN,
CATREG, CATPCA, TREES, and at least some of the procedures under COMPLEX
SAMPLES.
Art Kendall
Social Research Consultants
On 3/17/2010 7:42 AM, zen wrote:
> Hello everyone, I'm migrating from SAS to SPSS. It's fine for most of
> the functions I use from SAS, but there are some SAS functions which I
> miss greatly. I'm hoping someone may know the an simple equivalent in
> SPSS.
>
> 1. Capture output from basic statistics procedures such as means /
> frequencies
> In SAS, the Proc functions (Proc Means, Proc Univariate etc) include
> the option to output to a dataset. In SPSS, is there an easier
> alternative to OMS? OMS requires more steps in terms of knowing the
> labels of the tables, and additional syntax. SAS's Proc means also
> allow very fine control of the percentiles to output, eg.
> Proc means data=dataset;
> output out=percentile_table pctlpre = p pctlpts = 1 to 100 by 1;
> run;
>
> I wasn't able to find something similar in SPSS.
>
> 2. Proc sql's select into feature :
> eg.
> proc sql;
> select var1, count(*) as n into :a separated by " ", :b separated by "
> "
> from dataset
> group by var1;
> quit;
>
> In SPSS, I would generate the respective statistics, then oms to
> output to a text file or spss dataset, and perform further table
> transformations to extract the individual components. I'm hoping
> there's a shorter way of achieving the "select into" function.
>
> 3. Iteratively processing delimited list, in sas :
> %let delimited_list = var1 var2 var3;
> %let counter = 1;
> %do %until (%scan(&delimited_list,&counter, " ") eq ));
> ----SOME SAS FUNCTIONS to process var1 to var3
> %end;
>
> I haven't found an alternative for SPSS.
>
> 4. Referring to all Character or Numeric variables
> SAS has _ALL_, _NUMERIC_ and _CHARACTER_ keywords, which makes it easy
> to work with many variables such as :
> Proc univariate data=dataset;
> var _NUMERIC_;
> run;
> This generates univariate statistics for all numeric variables. In
> SPSS, I wasn't able to find a similar keyword.
>
> Thanks in advance for your attention!
>
|
|
0
|
|
|
|
Reply
|
Art
|
3/17/2010 2:29:09 PM
|
|
Hi Jon and Art, thanks for taking time to help! The suggestions are
great, I'll give it a try!
On Mar 17, 10:29=A0pm, Art Kendall <A...@DrKendall.org> wrote:
> In SPSS there are often many ways to do things. In addition to what Jon
> said see
> LOOP
> and
> I don't know if every variable list can take ALL as an argument but
> certainly many do. =A0To deal with just numeric or string variables see
> SORT VARIABLES after which you could use the TO convention.
>
> DATASET ACTIVATE DataSet1.
> display dictionary.
> SORT VARIABLES BY type (A).
> display dictionary.
>
> Jon mentioned that many procedures have direct to dataset options, some
> examples off the top of my head are DESCRIPTIVES, CROSSTABS,
> PROXIMITIES, FACTOR, REGRESSION, QUICK CLUSTER, TWOSTEP, DISCRIMINANT,
> AGGREGATE, CORRELATIONS, MATRIX, ONEWAY, REPORT, UNIANOVA, GLM, GENLIN,
> CATREG, CATPCA, TREES, and at least some of the procedures under COMPLEX
> SAMPLES.
>
> Art Kendall
> Social Research Consultants
>
> On 3/17/2010 7:42 AM, zen wrote:
>
>
>
> > Hello everyone, I'm migrating from SAS to SPSS. It's fine for most of
> > the functions I use from SAS, but there are some SAS functions which I
> > miss greatly. I'm hoping someone may know the an simple equivalent in
> > SPSS.
>
> > 1. Capture output from basic statistics procedures such as =A0means /
> > frequencies
> > In SAS, the Proc functions (Proc Means, Proc Univariate etc) =A0include
> > the option to output to a dataset. In SPSS, is there an easier
> > alternative to OMS? OMS requires more steps in terms of knowing the
> > labels of the tables, and additional syntax. SAS's Proc means also
> > allow very fine control of the percentiles to output, eg.
> > Proc means data=3Ddataset;
> > output out=3Dpercentile_table pctlpre =3D p pctlpts =3D 1 to 100 by 1;
> > run;
>
> > I wasn't able to find something similar in SPSS.
>
> > 2. Proc sql's select into feature :
> > eg.
> > proc sql;
> > select var1, count(*) as n into :a separated by " ", :b separated by "
> > "
> > from dataset
> > group by var1;
> > quit;
>
> > In SPSS, I would generate the respective statistics, then oms to
> > output to a text file or spss dataset, and perform further table
> > transformations to extract the individual components. I'm hoping
> > there's a shorter way of achieving the "select into" function.
>
> > 3. Iteratively processing delimited list, in sas :
> > %let delimited_list =3D var1 var2 var3;
> > %let counter =3D 1;
> > %do %until (%scan(&delimited_list,&counter, " ") eq ));
> > =A0 =A0----SOME SAS FUNCTIONS to process var1 to var3
> > %end;
>
> > I haven't found an alternative for SPSS.
>
> > 4. Referring to all Character or Numeric variables
> > SAS has _ALL_, _NUMERIC_ and _CHARACTER_ keywords, which makes it easy
> > to work with many variables such as :
> > Proc univariate data=3Ddataset;
> > var _NUMERIC_;
> > run;
> > This generates univariate statistics for all numeric variables. In
> > SPSS, I wasn't able to find a similar keyword.
>
> > Thanks in advance for your attention!
|
|
0
|
|
|
|
Reply
|
zen
|
3/17/2010 3:04:06 PM
|
|
|
3 Replies
483 Views
(page loaded in 0.177 seconds)
|