BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
acelini
Fluorite | Level 6

I am attempting to analyse the incidence rates of diseases for different ethnicities. Currently ethnicity is coded as a double digit.

I want to analyses the rates of disease for different groups of Pacific Peoples. In the data itself there are multiple ethnic groups that fit under this. I am only interested in five pacific groups for analysis which are coded as follows:

 

samoan = 31

tongan = 32

cook island maori = 33

aggregated other pacific = 30, 34, 35, 36, 37

total pacific = 30, 31, 32, 33, 34, 35, 36, 37

 

I want to assign a value to each of the analysis groups (so samoan ends up as 1, tongan as 2, cookisland maori as 3, aggregated other pacific = 4 and lastly the total pacific group = 5). Is this possible? And if so what sort of expression would I use to do that.

 

The dataset looks as follow:

 

clientid     dob               ethnicgp     gender     domicilecode

63287     05/04/1987    34               M             0441

87234     18/11/1963    30               F              8823

09834      27/01/2000   37               F              3015

23432     03/07/1991    31               M             2125

 

Thanks in Advance

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

A format or IF/THEN statement would work here.

Formats are better and easier to manage in my opinion.

 


@acelini wrote:

I am attempting to analyse the incidence rates of diseases for different ethnicities. Currently ethnicity is coded as a double digit.

I want to analyses the rates of disease for different groups of Pacific Peoples. In the data itself there are multiple ethnic groups that fit under this. I am only interested in five pacific groups for analysis which are coded as follows:

 

samoan = 31

tongan = 32

cook island maori = 33

aggregated other pacific = 30, 34, 35, 36, 37

total pacific = 30, 31, 32, 33, 34, 35, 36, 37

 

I want to assign a value to each of the analysis groups (so samoan ends up as 1, tongan as 2, cookisland maori as 3, aggregated other pacific = 4 and lastly the total pacific group = 5). Is this possible? And if so what sort of expression would I use to do that.

 

The dataset looks as follow:

 

clientid     dob               ethnicgp     gender     domicilecode

63287     05/04/1987    34               M             0441

87234     18/11/1963    30               F              8823

09834      27/01/2000   37               F              3015

23432     03/07/1991    31               M             2125

 

Thanks in Advance


 

View solution in original post

5 REPLIES 5
Reeza
Super User

A format or IF/THEN statement would work here.

Formats are better and easier to manage in my opinion.

 


@acelini wrote:

I am attempting to analyse the incidence rates of diseases for different ethnicities. Currently ethnicity is coded as a double digit.

I want to analyses the rates of disease for different groups of Pacific Peoples. In the data itself there are multiple ethnic groups that fit under this. I am only interested in five pacific groups for analysis which are coded as follows:

 

samoan = 31

tongan = 32

cook island maori = 33

aggregated other pacific = 30, 34, 35, 36, 37

total pacific = 30, 31, 32, 33, 34, 35, 36, 37

 

I want to assign a value to each of the analysis groups (so samoan ends up as 1, tongan as 2, cookisland maori as 3, aggregated other pacific = 4 and lastly the total pacific group = 5). Is this possible? And if so what sort of expression would I use to do that.

 

The dataset looks as follow:

 

clientid     dob               ethnicgp     gender     domicilecode

63287     05/04/1987    34               M             0441

87234     18/11/1963    30               F              8823

09834      27/01/2000   37               F              3015

23432     03/07/1991    31               M             2125

 

Thanks in Advance


 

Cynthia_sas
SAS Super FREQ
Hi:
I second Reeza's comment. Multi-label formats are respected by several SAS procedures and are very handy for calculating the type of statistics you want. Here's an example using PROC REPORT and calculating the MEAN statistic http://go.documentation.sas.com/?docsetId=proc&docsetTarget=p1kkf0fl0y3yeon1qxyme7bp7hcn.htm&docsetV... and here is an example with TABULATE http://go.documentation.sas.com/?docsetId=proc&docsetVersion=9.4&docsetTarget=n0d6gp6j8o8592n1ai5e6t... and, here is a paper with a percent example on pages 7 and 8 http://www2.sas.com/proceedings/sugi31/249-31.pdf (it is an older paper, but the concepts are still good).

cynthia
acelini
Fluorite | Level 6

In attempting to create to do so I keep coming across an error.

 

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 proc format;
74 value ethnicgpfmt (notsorted);
NOTE: Format ETHNICGPFMT has been output.
75 31='Samoan'
__
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
 
76 32='Tongan'
77 33='Cook Island Maori'
78 30 ='Aggregated Other Pacific'
79 34-37='Aggregated Other Pacific'
80 21='NZ Maori'
81 10-12='Non Maori Pacific'
82 40-high='Non Maori Pacific';
NOTE: The previous statement has been deleted.
83 run;
 
 
What exactly is this error referring to?
 
 
Cynthia_sas
SAS Super FREQ

Hi,
I believe you need to refer to the documentation for how to specify your values on the left side of the = sign. Here's the page: http://go.documentation.sas.com/?docsetId=proc&docsetTarget=n03qskwoints2an1ispy57plwrn9.htm&docsetV...

For example, it appears to me that code 76 and code 32 are 2 separate codes based on your previous posting -- and if they are, indeed 2 separate values, then they would need to be spectified as
76, 32 = 'Tongan' (note the 2 values are separated by commas)

cynthia

Reeza
Super User

You don't need a semi colon after the VALUES statement, it's all one statement.

 


@acelini wrote:

In attempting to create to do so I keep coming across an error.

 

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 proc format;
74 value ethnicgpfmt (notsorted); <- this is too early.
NOTE: Format ETHNICGPFMT has been output.
75 31='Samoan'
__
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
 
76 32='Tongan'
77 33='Cook Island Maori'
78 30 ='Aggregated Other Pacific'
79 34-37='Aggregated Other Pacific'
80 21='NZ Maori'
81 10-12='Non Maori Pacific'
82 40-high='Non Maori Pacific';
NOTE: The previous statement has been deleted.
83 run;
 
 
What exactly is this error referring to?
 
 

 

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1116 views
  • 2 likes
  • 3 in conversation