'I'm getting an error that says my random_number variable doesn't exist. Any advice on what I should do to create it?

I'm working on homework and I need to take random observations from a data set. I am trying to create the random data set based on my teacher's coding instructions but I keep getting an error saying my random_number variable does not exist. I have posted an image of my code. Do I need to create the variable or make a proc sort for it? Code

Here are the error logs:

434 proc print data= random_sample (obs=100); 435 var id country year random_number pr cl; ERROR: Variable RANDOM_NUMBER not found. 436 run;

NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE PRINT used (Total process time): real time 0.00 seconds cpu time 0.00 seconds

sas


Solution 1:[1]

In your photograph of code the data step that looks like it is trying to create a list of random numbers will fail because it does not have an END for the DO loop. (unless you have it at the end of some line that is out of frame from the camera.)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tom