|
dk,
DO IF $CASENUM=1.
COMPUTE #RV=NORMAL(0,.1).
END IF.
* If you want a permanent copy *.
COMPUTE RV=#RV.
'--------
Note use of scratch variable.
Read up on scratch variables.
--
drewk wrote:
>
> I'm attempting to generate random 'constant' variables. I mean random as
> in randomly generated, and constant as in constant across all
> observations. I intend this to be used as a multiplier of sorts which is
> randomly generated when the syntax is run to introduce a little variation.
>
> For example, I have a probability for a certain event, and I am running
> multiple 'trials' of this event and recording the outcome. For theoretical
> reasons, I want to add or subtract a randomly generated value (something
> like RV.Normal(0,.1)) from this probability for each observation. However,
> just generating a variable such as:
>
> compute randomadjustment = RV.Normal(0,.1).
>
> will create a unique random number for each observation. However, I want
> this adjustment to be constant across all observations. This way, every
> time the syntax is run, every observation's probability has the same
> random number added or subtracted from it. Is it possible to generate a
> 'random constant variable'?
>
> I hope all of this makes sense. Thanks for any help,
> -dk
>
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Generating-random-constants-tp4470695p4470810.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
|