From the course: SAS Essential Training: 1 Descriptive Analysis for Healthcare Research
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Solution: Make a categorical variable from a continuous one - SAS Tutorial
From the course: SAS Essential Training: 1 Descriptive Analysis for Healthcare Research
Solution: Make a categorical variable from a continuous one
(upbeat music) - [Narrator] Okay, here is my solution. My solution code starts here. So let me highlight and run all the code before it. So it puts us on the results tab, but let's go back to the code. Okay, remember, our assignment was to create a new variable called BPGRP, that would be a categorical variable, based on the continuous variable, BPXOSY1, which is systolic blood pressure. We'd code it according to the categories of hypertension status from the AHA I listed on the slide when I was introducing the challenge. Here's my data step. I created the variable BPGRP, and I decided to code missing or unknown as nine. So I started with populating every record with a nine. Then below that, I tell SaaS to update the record with a new code if it fits the criteria. The first one says if the source variable is less than 120 and is not equal to missing, then set BPGRP to one. You need to add in the and not equal to missing because SAS has a weird sort order that sorts missing before the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Recoding a grouped variable7m 3s
-
(Locked)
Recoding the smoking variable6m 3s
-
(Locked)
Creating flags: Indicator variables5m 22s
-
(Locked)
Grouping a continuous variable5m 3s
-
(Locked)
Cleaning a continuous variable4m 48s
-
(Locked)
Completing the analytic dataset4m 38s
-
(Locked)
Challenge: Make a categorical variable from a continuous one4m 52s
-
(Locked)
Solution: Make a categorical variable from a continuous one3m 27s
-
-
-
-
-
-
-