BookmarkSubscribeRSS Feed
khalillx
Fluorite | Level 6

In this code how do I change the sample size of data from 10 to 1000?:

data samples;

do samp = 1 to 10;

do t = 1 to 100;

      u = rannor(1996)*5;

      x = 100 + 3*rannor(6991);

      y = 10 + 0.5*x + u;

      output;

  end;

end;

run;

 

Do I just change the number 10 to 1000? I just tried that in SAS and now SAS has been loading for awhile. I'm worried I got it jammed and now it's messed up. 

2 REPLIES 2
novinosrin
Tourmaline | Level 20

"Do I just change the number 10 to 1000?"

That's correct

 

 

"I just tried that in SAS and now SAS has been loading for awhile."

That's not likely. Maybe you need to close and restart

 

ballardw
Super User
201  data work.samples;
202  do samp = 1 to 1000;
203  do t = 1 to 100;
204        u = rannor(1996)*5;
205        x = 100 + 3*rannor(6991);
206        y = 10 + 0.5*x + u;
207        output;
208    end;
209  end;
210  run;

NOTE: The data set WORK.SAMPLES has 100000 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.12 seconds
      cpu time            0.01 seconds

0.12 seconds to create a data set of 100000 records with samp=1000. And mine isn't a particularly fast computer.

 

If you increased the value of T as well that might lead to more time. Show the code you actually submitted when testing SAMP= 1 to 1000

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 759 views
  • 0 likes
  • 3 in conversation