BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
PeterBuzzacott2
Calcite | Level 5

Hello, I have an Excel spreadsheet with 17 rows of data. The first column is YEAR, the second column is a continuous value from 0 to 4.29, called RawRate. That's the data.

I have run a bootstrapping simulation with 10,000 replications, then a Proc Means to characterise the distribution of the simulated means. This all works, here is the output:

The MEANS Procedure                          (Lower 95%, Upper 95%, Mean, StdDev, Min, Max, n)

1.9854599

1.99823211.99184601.343402404.2900000

170000

What I have been struggling with is that I would like to export the 10,000 simulated means to an Excel file. I have tried a DM function but it's not working, it just exports two columns; the first is the number of each iteration and the second is from 1 to 17, 10,000 times. Here is the code - how can I export the simulated means please?

data ;
do sampnum = 1 to 10000; /* To create 10000 bootstrap replications */
do i = 1 to 17; /* Want same no. obs as in ORIGINAL */
x = round(ranuni(0) * 17); /* x randomly selected from values 1 to NOBS */
set YearRate
nobs = nobs
point = x; /* This selected the xth observation in ORIGINAL */
output; /* Send the selected observation to the new data set */
end;
end;
stop; /* Required when using the POINT= command */
run;

proc means CLM mean stddev min max n;
var RawRate;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

> Here is the message from the Log:

This is not the full log. Please post the full log.

 

View solution in original post

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

I see nothing wrong with your code (except that you don't name the data sets).

Where's the failing export code?

What's the DM function?

Note that you could use this easier syntax to pick random observations:

X = rand('integer', 1, 17);

 

 

PeterBuzzacott2
Calcite | Level 5
Thanks Chris
There is no failing export code, the data are being exported successfully. This issue I am having is that the exported data are not the data I want exported. Here is the message from the Log:
sampnum=10001 i=18 x=5 nobs=0 _ERROR_=1 _N_=1
NOTE: The data set WORK.DATA3 has 170000 observations and 2 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds

The two variables that are output are:
In the first column, 1-17,000
In the second column, 1-17, 10,000 times.

What I am looking for is a third column with the 170,000 actual numbers used to generate the 10,000 simulated means.
Or, 10,000 rows with the 10,000 simulated means.

When I run the PROC Means I get a mean value from n=170,000, so I know the values are in there somewhere. How can I export them into excel?

I did not keep the DM unction because it was not helpful.
ChrisNZ
Tourmaline | Level 20

> Here is the message from the Log:

This is not the full log. Please post the full log.

 

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
  • 3 replies
  • 432 views
  • 0 likes
  • 2 in conversation