Research Project (2): Create Frequency Tables in SAS

*SAS studio is used for this course. Link:

A mistake in my previous post

I said the variables were AGE, ATTEMPTED SUICIDE, AGE AT FIRST TIME SOUGHT HELP. But they are labels, not variable names. The variables are: AGE, S4AQ4A16, S4AQ19A.


This post is for the week 2 assignment of the Coursera course Data Management and Visualization by Wesleyan University.

Aim of the assignment:

Use the NERSARC dataset to examine frequency distribution of the three variables (labeled) in the subset, and interpret the output tables.

Research question: Among young adults aged 18-26 who had previously sought help, is age of seeking help for the first time associated with history of suicide attempts

Values for age of seeking help for the first time: 5-26: age.

Values for history of suicide attempts: 1=yes (had attempted suicide), 2=no (no suicide attempts).

My hypothesis is that people who sought help for the first time at an earlier age are less likely to have history of suicide attempts.

I refined my research question and narrowed my study sample to those who had sought help. It is different from what I wanted to do in my first post.

In this post, I will include:

  • codes of the SAS program
  • results of the program – tables of frequency distribution
  • my interpretation of the frequency distribution



Run & Check the LOG

No errors. No warnings.

NOTE: There were 645 observations read from the data set WORK.NEW.





In the subset of data, observations were those aged 18-26, answered yes or no to the suicide attempts question, and reported the age when they sought help for the first time. The total number of observations in the subset were 645. There are no missing data because they were excluded due to the logic statements in the program.

According to the first table, those aged 18, 19, 20, 21, 22, 23, 24, 25, 26 each took about 10% of the sample. They appear to be equally distributed among different ages from 18 to 26.

In the second table, value 1 is yes, 2 is no. 172 people (26.67%) reported having suicide attempts, and 473 (73.33%) reported no suicide attempts.

In the first column of the third table, 5-26 means the age when the participant first sought help. The majority of them (N=507, 78.6%) reported seeking help for the first time when they were 13-22 years old. Fewer people first sought help below 13 or over 22.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s