Find out the most popular SAS Users YouTube channel how to tutorials, and learn a thing or two!
2020 roundup: SAS Users YouTube channel how to tutorials was published on SAS Users.
Find out the most popular SAS Users YouTube channel how to tutorials, and learn a thing or two!
2020 roundup: SAS Users YouTube channel how to tutorials was published on SAS Users.
Do you need to see how long patients have been treated for? Would you like to know if a patient’s dose has changed, or if the patient experienced any dose interruptions? If so, you can use a Napoleon plot, also known as a swimmer plot, in conjunction with your exposure […]
How to create a Napoleon plot with Graph Template Language (GTL) was published on SAS Users.
This code demonstrates an algorithm for estimating birth date from age. We cannot know the exact birth date, but we can get close: the maximum error is half a year, and the typical error is one quarter of a year.
/* The %age macro was taken from the Internet---maybe from here http://support.sas.com/kb/24/808.html ? */
%macro age(date,birth);
floor ((intck('month',&birth,&date) - (day(&date) %mend age;
/*
Generate 10000 fake people with random birth dates and random perspective days
on which their age was measured. Then, calculate age from that perspective date.
In reality, there is some seasonality to births (e.g., more births in July), but
here we assume each day of the year has an equal distribution of births.
*/
data person;
format birth_date submit_date yymmdd10.;
do i = 1 to 10000;
birth_date = %randbetween(19000,20500);
submit_date = birth_date + %randbetween(0,100*365);
age = %age(submit_date, birth_date);
output;
end;
drop i;
%runquit;
/* Work in reverse from age to estimated birth date. */
data reverse;
set person;
format birth_date_min birth_date_max yymmdd10.;
birth_date_min = intnx('years', submit_date, -1 * (age+1), 's') - 1;
birth_date_max = intnx('years',birth_date_min,1,'s') + 1;
/* check range of estimates for errors */
min_error = (birth_date > birth_date_min);
max_error = (birth_date < birth_date_max);
/* estimate birth date as the middle of the range */
birth_date_avg = mean(birth_date_min, birth_date_max);
/* calculate variance */
abs_days_error = abs(birth_date - birth_date_avg);
%runquit;
/* Both errors should always be zero. */
proc freq data=reverse;
table min_error max_error;
quit;
/* Error of estimates range from 0 to 183.5 with a median of 92 and average of 91.*/
proc means data=reverse n nmiss min median mean max;
var abs_days_error;
quit;
/* Distribution of errors is uniform */
proc sgplot data=reverse;
histogram abs_days_error;
quit;
Tested with SAS 9.4M6
For more posts like this, see Heuristic Andrew.
My SAS is a brand-new customer experience page. This new location takes a variety of customer service places and puts them in one interface. The goal of My SAS is to ensure all SAS customers have the best possible experience available in the marketplace.
Meet My SAS was published on SAS Users.
Passionate about helping SAS customers, Sandy Gibbs of Technical Support sheds light on the SASHFADD tool report. This is the second of three posts on our hot-fix process.
Understanding the SAS Hot Fix Analysis, Download and Deployment Tool Report was published on SAS Users.
In my previous blog post, I talked about using PROC CAS to accomplish various data preparation tasks. Since then, my colleague Todd Braswell and I worked through some interesting challenges implementing an Extract, Transform, Load (ETL) process that continuously updates data in CAS. (Todd is really the brains behind getting […]
Append and Replace Records in a CAS Table was published on SAS Users.
SAS’ Sandy Gibbs kicks off a series of posts on hot fixes for SAS®9 environments.
The SAS Hot Fix Analysis, Download and Deployment (SASHFADD) Tool was published on SAS Users.
The Little SAS Book, Sixth Edition is now a year old. I have already written posts about What’s New in this edition, and the very cool XLSX LIBNAME engine. So what more is there to say? A lot, it turns out. The Sixth Edition was our biggest rewrite since the Second Edition introduced the new […]