I am trying to figure out how many surveys have been completed each month so far this year. I used the following:
count=intck('survey_complete','01apr2021'd, '01may2021'd)
And received the following error:
ERROR 180-322: Statement is not valid or it is used out of proper order.
I am also unsure if this is a stand alone statement, a data step, or something else entirely.
Your statement using INTCK can only be valid inside a data step, and must end with a semi-colon. The first argument must be a calendar interval like 'month' or 'year', it can't be 'survey_complete' which is not recognized.
Please show some sample data and explain what you are trying to do in more detail.
Thank you for the information. I just realized that the survey_complete variable also has a time stamp so the information is shown as:
9/14/2021 2:21:00 PM
My ultimate goal is to be able to have the data to create a table like the following:
Month | Surveys Completed |
January | 3 |
February | 5 |
March | 10 |
This really helped, thanks! The table prints just fine, but the months are not merging. Please see example below. Any suggestions?
proc freq data=grace;
table survey_timestamp /missing out=summary_month;
format survey_timestamp;
run;
survey_timestamp | Frequency | Percent | Cumulative | Cumulative |
Frequency | Percent | |||
22 | 52.38 | 22 | 52.38 | |
5/24/2021 | 1 | 2.38 | 23 | 54.76 |
6/10/2021 | 1 | 2.38 | 24 | 57.14 |
6/21/2021 | 1 | 2.38 | 25 | 59.52 |
7/14/2021 | 1 | 2.38 | 26 | 61.9 |
7/15/2021 | 1 | 2.38 | 27 | 64.29 |
7/9/2021 | 1 | 2.38 | 28 | 66.67 |
8/13/2021 | 1 | 2.38 | 29 | 69.05 |
8/18/2021 | 1 | 2.38 | 30 | 71.43 |
8/20/2021 | 2 | 4.76 | 32 | 76.19 |
8/23/2021 | 1 | 2.38 | 33 | 78.57 |
8/31/2021 | 1 | 2.38 | 34 | 80.95 |
9/1/2021 | 1 | 2.38 | 35 | 83.33 |
9/13/2021 | 1 | 2.38 | 36 | 85.71 |
9/14/2021 | 1 | 2.38 | 37 | 88.1 |
9/15/2021 | 1 | 2.38 | 38 | 90.48 |
9/2/2021 | 1 | 2.38 | 39 | 92.86 |
9/8/2021 | 1 | 2.38 | 40 | 95.24 |
[not completed] | 2 | 4.76 | 42 | 100 |
Hello. Below is my code for the table (I did add in your DTMONYY5 statement).
proc freq data=grace;
table survey_timestamp /missing out=summary_month;
format survey_timestamp DTMONYY5;
run;
I formatted it after the code you initially sent:
proc freq data=have;
table survey_complete /missing out=summary_month;
format survey_complete yymmn6.;
run;
I am still getting the dates separately, not combined/counted.
At this point, you need to show us some sample data. Plaese follow these instructions. Do not attach files or provide screen captures.
Thank you again for responding. I did use the DTMONYY5 format and it ran without an error. I appreciate your help.
On a separate note regarding the date/time, I later converted this variable to a character variable in the format of "Month ID" and was able to summarize the data based on this month-id level.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.