Hello,
I am using the rand function to simulate a data set to use for an analysis. I am using moments from a pre-existing data set to guide the simulation (I am not able to use the original data so proc surveyselect is not an option for me), but I am having difficulty simulating the follow-up time to match the outcome (binary event) in each treatment group because the distributions are non-standard. I read that it's possible to use a macro to simulate data specifying the distribution parameters needed, but I am having problems putting the SAS code together successfully. I would appreciate an points in the right direction.
Thank you.
I don't have an answer to your question, but I moved it to the statistics forum.
In general for anything simulation related, @Rick_SAS is the guru and his book is a great reference.
Simulating data with SAS
https://www.amazon.ca/Simulating-Data-SAS-Rick-Wicklin/dp/1612903320
@MichelleR0 wrote:
Hello,
I am using the rand function to simulate a data set to use for an analysis. I am using moments from a pre-existing data set to guide the simulation (I am not able to use the original data so proc surveyselect is not an option for me), but I am having difficulty simulating the follow-up time to match the outcome (binary event) in each treatment group because the distributions are non-standard. I read that it's possible to use a macro to simulate data specifying the distribution parameters needed, but I am having problems putting the SAS code together successfully. I would appreciate an points in the right direction.
Thank you.
Thank you. I have downloaded Chapter 2 available online for free. This is a one time task so I was hoping to avoid having to purchase any books. Thanks for the quick reply.
Rick has written many articles on this topic, which you can find on his blog here. Free!
Can you provide more details, or show some data and code? Are you simulating univariate data or multivariate data?
When you are simulating from non-normal data, you can fit the data to a flexible distribution with several parameters, then simulate from that distribution. If you provide more details about your problem, we can probably steer you in the right direction.
It will also be helpful to know what products you have access to. Do you have SAS/IML or SAS/ETS?
I have to say I wonder about this bit of code:
If rand("uniform") < 0.666 then var = 0; else var = 1; var = rand("Table", of a[*]);
You conditionally set var to 0/1. Then immediately set it to some integer in the range [1,6] where 0 is no longer possible. So why bother with the rand("uniform") test at all.
The way to proceed is this:
1. Simulate the explanatory variables.
2. Simulate the response variable as a STATISTICAL MODEL of the explanatory variables. I haven't blogged about survival models, although they are discussed in Chapter 12 of my book (p.242-247). To get an idea about what it means to simulate a response from a model, start with the more familiar linear regression models:
Although I haven't blogged about survival models, you can see examples on the web or you can read Gibbs and Kiernan (2020), "Simulating Data for Complex Linear Models." The survival example is p 17-18.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.