Hot to put precalculated numerical VALUE into MACRO?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Hot to put precalculated numerical VALUE into MACRO?

Sasha-20
In the syntax below, "88" should be replaced with another number as a
result of preceeding calculations.


    CORRESPONDENCE Table = all( 7, 88)
      /DIMENSIONS = 2
      /MEASURE = CHISQ
      /STANDARDIZE = RCMEAN
      /NORMALIZATION = SYMMETRICAL
      /PRINT = TABLE RPOINTS CPOINTS
      /PLOT = NDIM(1,2) BIPLOT(20) .


For instance I precaluclated num_of_vars = number of variables:

    compute num_of_vars=0.
    exe.
    do repeat var=all.
      compute num_of_vars=num_of_vars+1.
    end repeat.
    exe.

Now, num_of_vars contains the actual number of variables in the dataset.
How can I replace "88" in the syntax above with this value in the
num_of_vars variable?

I tried to do that through defining macro with arguments, but it doesn't
seem to work with values of variables.

Can anyone help, please?
Reply | Threaded
Open this post in threaded view
|

Re: Hot to put precalculated numerical VALUE into MACRO?

Albert-Jan Roskam
--The SPSS module of the Python module has a
SetMacroValue function. That's probably the nicest way
to do it, but I can't tell you (yet) how exactly it
should be done.
--This is another way:
get file='C:\Program Files\Spss\Employee data.sav'.
n of cases 1.
flip.
compute dummy = 1.
aggregate outfile = * / break = dummy / n = n.
print outfile = "d:\temp\number.sps" / "define
               n_of_vars () " n "!enddefine.".
exe.
insert file = "d:\temp\number.sps" .
exe.
display macros.

Cheers!!
Albert-Jan

--- Sasha <[hidden email]> wrote:

> In the syntax below, "88" should be replaced with
> another number as a
> result of preceeding calculations.
>
>
>     CORRESPONDENCE Table = all( 7, 88)
>       /DIMENSIONS = 2
>       /MEASURE = CHISQ
>       /STANDARDIZE = RCMEAN
>       /NORMALIZATION = SYMMETRICAL
>       /PRINT = TABLE RPOINTS CPOINTS
>       /PLOT = NDIM(1,2) BIPLOT(20) .
>
>
> For instance I precaluclated num_of_vars = number of
> variables:
>
>     compute num_of_vars=0.
>     exe.
>     do repeat var=all.
>       compute num_of_vars=num_of_vars+1.
>     end repeat.
>     exe.
>
> Now, num_of_vars contains the actual number of
> variables in the dataset.
> How can I replace "88" in the syntax above with this
> value in the
> num_of_vars variable?
>
> I tried to do that through defining macro with
> arguments, but it doesn't
> seem to work with values of variables.
>
> Can anyone help, please?
>



Cheers!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Did you know that 87.166253% of all statistics claim a precision of results that is not justified by the method employed? [HELMUT RICHTER]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



____________________________________________________________________________________
Got a little couch potato?
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz