I am a newbie in SAS. And I got a data to solve.
The data contains date of birth and number of people who took insurance.
We need to find for each month how many people took insurance.
Arpit
Hi,
This is a SAS forum, not an Excel one? Has your data been imported to SAS? If so can you show an example in the form of a datastep. AS for the code once you have it in SAS then that is pretty easy:
proc sql; create table WANT as select month(YOUR_DATE) as MON, count(PERSON) as NUMBER_OF_PEOPLE from HAVE group by month(YOUR_DATE); quit;
Without seeing some test data and required output I am just guessing though (and no, I don't download Excel files).
@Arpitgt Welcome to SAS.
Your question isn't clear as to what you need help with.
Depending on what you're trying to do, there's a lot of options. Are you having trouble importing the data, or calculating your measure of how many people each month took insurance?
Also, many people here do not download Excel files, so it's best to post your data in your question, a small sample at any rate.
I am having trouble to calculate how many people each month took insurance?
Below is the data for first 22 days in january. Remaining data is same as below for every month :-
date no_of_births
1/1 1482
1/2 1213
1/3 1220
1/4 1319
1/5 1262
1/6 1271
1/7 1355
1/8 1219
1/9 1253
1/10 1339
1/11 1293
1/12 1295
1/13 1296
1/14 1333
1/15 1409
1/16 1330
1/17 1286
1/18 1268
1/19 1336
1/20 1422
1/21 1318
1/22 1302
That would need some clarification,
date no_of_births
1/1 1482
1/2 1213
1/3 1220
What type is date, as 1/1 is not a date. Is it a SAS numeric date variable, i.e. 01JAN2016 for example? Is no_of_births a numeric variable? For example:
data have; date="01JAN2016"d; no_of_births=1482; output; date="02JAN2016"d; no_of_births=1213; output; run; proc sql; create table WANT as select distinct month(DATE) as MON, sum(NO_OF_BIRTHS) as NUMBER_OF_BIRTHS from HAVE group by month(DATE); quit;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.