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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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