Hi
Can anyone of you run the following code and attached the data set it generate?This is from the article attached url -page # 4 My SAS is expired and now in proceed of renewing the licence.I would like to learn in depth about this article until I get my licence renewed.
Thant would be great help
Options mprint mlogic sympblegen;
%macro generate(EmpCount =%str()
,AvgCoLambda=
,UserGrpLambda=
,MaxRepeats= );
data CallsPerHour;
/*Assume base rate is in hour per 1000 Emps*/
do emps= &EmpCount;
do repeats=1 to &MaxRepeats;
/*Average company*/
CoType="Avg ";
EmpsAtCo=emps;
calls=rand('POISSON',&AvgCoLambda);
output;
/*Average company with user group*/
CoType="AvgWUserGroup";
EmpsAtCo=emps;
calls=rand('POISSON',&UserGrpLambda);
output;
/*you can add additional company types here*/
/*A consulting company?-w/ a different lambda*/
end; /*do repeats=1 to 5;*/
end; /*do emps= & EmpCount;*/
run;
proc greplay nofs IGOut=GSeg;
delete _all_;
quit;;
proc univariate data=CallsPerHour normal;
var calls;
/* freq calls;*/
histogram calls /midpoints =1 to 20 by 1;;
run;
Proc sort data=CallsPerHour;
by CoType emps;
run;
s
I can't explain what the code is supposed to do. I leave that part to you. But I can give you some guidance on how to turn this into something you can run and play with.
Get rid of the macro language. So the %macro statement and %mend statements get removed.
Any time you see &, replace that with a reasonable value. For example, the code contains:
do Emp = &EmpCount;
Replace that, possibly with:
do Emp = 1000, 3000, 5000, 10000;
The code also contains:
do repeats = 1 to &MaxRepeats;
Replace that, possibly with:
do repeats = 1 to 50;
The code contains:
calls = rand("POISSON", &userGrpLambda);
Replace that, possibly with:
calls = rand("POISSON", 5);
Similarly, try replacing &AvgCoLambda with 8.
I can't tell you what values to use. But choosing reasonable values and replacing the macro language will give you a look at what the program is supposed to do.
Reeza, This is not for any commercial use . I am genuinely asking for help and I would like to at least prepare for my data the way it is in this article.I hope you understand my situation.
Then you can use Academics on Demand. Any reason you can't do that?
EDIT: you do not need to be in University or an 'academic' to use either SAS University Edition or Academics on Demand (independent learner). You can access it here:
https://www.sas.com/en_us/software/on-demand-for-academics.html
or SAS UE here:
https://www.sas.com/en_us/software/university-edition.html
@chuie wrote:
Reeza, This is not for any commercial use . I am genuinely asking for help and I would like to at least prepare for my data the way it is in this article.I hope you understand my situation.
Thank you Astounding. I am no knowledge of macro so I do not know. The article says that this is the code used to generate the data used in this article. If you could just give me how the data is arranged with the variable name used in the code above that would be very very helpful to follow along the article and to do same analysis using my data.
So based on the code below, it looks like we just need three variables, 1. cotype, 2. emps and 3. calls
is this as simple as :
cotype emps calls
a 50 120
b 200 130
... and so one?
proc univariate data=CallsPerHour normal;
by CoType emps;
var calls;
histogram calls /midpoints =1 to 15 by 1;
run;
run; %mend generate;
%generate(EmpCount=%str(1000, 3000, 5000,10000 )
,AvgCoLambda=8
,UserGrpLambda=5
,MaxRepeats=50 );
I can't explain what the code is supposed to do. I leave that part to you. But I can give you some guidance on how to turn this into something you can run and play with.
Get rid of the macro language. So the %macro statement and %mend statements get removed.
Any time you see &, replace that with a reasonable value. For example, the code contains:
do Emp = &EmpCount;
Replace that, possibly with:
do Emp = 1000, 3000, 5000, 10000;
The code also contains:
do repeats = 1 to &MaxRepeats;
Replace that, possibly with:
do repeats = 1 to 50;
The code contains:
calls = rand("POISSON", &userGrpLambda);
Replace that, possibly with:
calls = rand("POISSON", 5);
Similarly, try replacing &AvgCoLambda with 8.
I can't tell you what values to use. But choosing reasonable values and replacing the macro language will give you a look at what the program is supposed to do.
Great guidance Astounding. It might help me move forward to the article n my data prep. I sent my friend to run it and she said it works.
Thank you so very much
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.