Treatment FAQ

how to assign treatment group in sas

by Wilber Haley Published 2 years ago Updated 2 years ago
image

2. Some SAS code to assign the treatment groups with the help of a newly created variable – period, after we merge the above variables with the patient data set: data trt_new; set raw.trt; by patient; do i=1 to 4; /* we have four treatment periods */ if scan (trtdesc, i, '/')='a' then trt=1; else if scan (trtdesc, i, '/')='b' then trt=2; else if scan (trtdesc, i, '/')='c' then trt=3; else if scan (trtdesc, i, '/')='d' then trt=4; period=i; /* we assign different periods in this loop */ output; end; run; After this trt_new data set being merged with PAT data set by patient, you may merge this data set with any other data sets by centre, subject, period in order to assign the correct trt variable. However, AE counts are more complicated than traditional AE tables. We need more code to determine which AE counts occur in which treatment periods.

Full Answer

How to assign colors to categories in SAS?

There are several ways to assign colors to categories, including using PROC TEMPLATE to write your own ODS style. However, in SAS 9.3, the easiest option is to use an "attribute map." An attribute map is a small data set that describes how each category level should be rendered. Dan Heath wrote a blog post about the attribute map. In this article I give a simple example of using an attribute map with the SGPLOT procedure, and I show that you can use a format to help you create an attribute map.

What is the SGPLOT procedure in SAS?

The SGPLOT procedure in SAS makes it easy to display a different color for each level of a grouping variable. By default, when you specify the GROUP= option for a graph, colors are assigned to groups based on the current ODS style. But what can you do if you want to assign specific colors for group categories?

How many levels are there in the Proc program?

The program begins by using PROC format to define a mapping between a continuous variable (the difference between the proportion of women in 1980 and the proportion in 2010) and five discrete levels:

How to use attribute map?

To use an attribute map, you have to specify two pieces of information: the data set ( Attrs) and the ID variable ( Jobs ). You specify the data set by using the DATTRMAP= option on the PROC SGPLOT statement. You specify the map by using the ATTRID= option on the SCATTER statement, as follows:

image
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9