Hello, I would appreciate if someone helps me an appropriate approach to complete this task using
dataset d1 having lung cancer cases cacase and controls popcont exposed to 4 agents a1,a2,a3 and a4.
I need to
(1)Place exposures(1's) of each agent under its column heading and
(2)Find the common zeros for all the 4 agents: ie. ids unexposed (0's) to any of the 4 agents and
place the corresponding agent. The zeros are the ones commmon to all the agents. There are 6 id's unexposed(0's)
to the agents. ie. each one has 6 zero's.
In summary: a1: 9 exposures(1's) and 6 unexposures(0)-total 15 obs; a2:10 exposures(1's) and
the 6 zero's-total 16 obs; a3: 7 1's and 6 zero's-total 13 obs and a4: 6 1's and 6 zero; total 12 obs.
My SAS SQL code to place the 1's under each agent is inappropriate. The only good one is a1 having only
1's. Please I would need help here to place the 1's under their corresponding agent.There was an
error message-the global statement not supported.......
The SAS code and log are found below' the results are attached.
Thanks in advance for your help.
data d1;
input id$ a1 a2 a3 a4 lung$ 14-21;
datalines;
os1 1 0 0 1 ca case
os2 1 1 0 0 ca case
os3 0 0 0 0 pop cont
os4 1 0 0 1 pop cont
os5 0 1 0 0 ca case
os6 0 0 0 0 ca case
os7 1 0 1 1 pop cont
os8 0 1 0 0 ca case
os9 1 0 1 0 pop cont
os10 0 0 1 0 ca case
os11 0 1 0 0 pop cont
os12 0 1 0 0 pop cont
os13 1 1 1 1 pop cont
os14 0 0 0 0 pop cont
os15 1 0 0 1 ca case
os16 0 1 1 0 pop cont
os17 1 1 1 1 pop cont
os18 0 0 0 0 ca case
os19 0 1 0 0 pop cont
os20 0 0 0 0 ca case
os21 0 0 0 0 ca case
os22 1 1 1 0 ca case
;
The WHERE must be part of the SELECT, and there can be only one WHERE in a single SELECT.
For which observations do you want to select in that step? Those where only one agent is true, or those where any agent is true?
You could write this:
where a1=1 or a2=1 or a3=1 or a4=1
but I prefer this:
where sum(a1,a2,a3,a4) > 0
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.