BookmarkSubscribeRSS Feed
Ashwini_uci
Obsidian | Level 7

I have already run the log regression to get the adjusted results. OR .BUt I also need these unadjusted rates per 1000 to display the data in a graph for a different purpose..

And you probably read my erlier posts.. i got the % values out of freq, and ten i just multiplied them by 1000 to get rate per 1000.

but now that is not matching with the output i got after using sql command which PGstats guided me with..

Reeza
Super User

Can you post the code you used to get the adjusted rates?

And what's your primary treatment that you're testing for significance?

I'm guessing you just need to modify your logistic regression code and remove all the factors you adjusted for rather than use proc freq to get your unadjusted rates.

PGStats
Opal | Level 21

The true meaning of the rate depends on the meaning of your

weighting factor. But if it were always 1, the rates would mortality of males per 1000 males.

I don't see why SQL and FREQ should give different rates. This discrepancy should be understood before you trust the rate values. Can you post the PROC FREQ commands that produced tables you posted earlier?

PG

PG
Ashwini_uci
Obsidian | Level 7

heer are the commands..

proc freq data =library.nismicathcabg4;

tables  female*died /chisq;

where diagcathonly=1 and stemi=1;

weight discwt;

title 'Baseline table chisq for gender vs mortality in  STEMI patients with diagcath ';

run;

proc freq data =library.nismicathcabg4;

tables  female*died /chisq;

where pcionly=1 and stemi=1;

weight discwt;

title 'Baseline table chisq for gender vs mortality in  STEMI patients with pci ';

run;

proc freq data =library.nismicathcabg4;

tables  female*died /chisq;

where cabgonly=1 and stemi=0;

weight discwt;

title 'Baseline table chisq for gender vs mortality in  NONSTEMI patients with cabg ';

run;

PGStats
Opal | Level 21

The discrepancy could be related to the distinction between STEMI and NONSTEMI patients? Do you need this distinction?

PG
Ashwini_uci
Obsidian | Level 7

you are right... i was comparing the above numbers i got my SQL with the STEMI/NSTEMI numbers...

Sorry about the confusion,, but these numbers do match with my other overall analyses (without STEMI and NSTEMI)

But yes, i also need the distiction by STEMi/NSTEMI.

if you could let me know how and where do i add that to the SQL query, that will be great!!

Thanks again..

Ashwini_uci
Obsidian | Level 7

stemi and nstemi are also binary variables with values 0 and 1

PGStats
Opal | Level 21

You may just add this variable to the query, as in :

proc sql;

create table rates1000 as

select pcionly, diagcathonly, cabgonly, stemi, gender,

1000*sum(died*discwt)/sum(discwt) as rate1000

from library.nismicathcabg4

where pcionly or diagcathonly or cabgonly

group by pcionly, diagcathonly, cabgonly, stemi, gender;

select * from rates1000;

quit;

I am curious to know how you are going to express those rates, given the weights. You are not really counting people.

PG

PG
Ashwini_uci
Obsidian | Level 7

This worked too!! and my results matched with these numbers..

Thanks so much.. that has been a great help!!

The weighting part will be inlcuded in the methods section. These result are from a national unweighted database so when we report the results they have to be weighted. The % dont really change, but after weighting , because  the sample size increased,  it helps in getting a good OR value and significance level ..

The majority of my result are regressions, so the weghting really helps.

Thanks again.

Ashwini.

PGStats
Opal | Level 21

My pleasure.

Take a look at PROC SQL and the SQL language, if you can. It is a very powerful tool, very much in use.

All the best.

PG

PG
Ashwini_uci
Obsidian | Level 7

Hi there,

I hope you could help me with this one too..

in my dataset I have 15 variables from PR1, PR2, PR3..........- PR15. They contain data about medical conditions, in the form of codes. I want to create a new variable "PCI", that would be coded as 1 or 0. If any of the variables from PR1......PR15 contains any of these codes  ('0066', '3604', '3606', '3607') , then PCI will be coded as 1 otherwise 0.

I wrote the following array which is working fine.

data library.nismicathcabg4;

set library.nismicathcabg4;

array dxtrialpci{15} pr1-pr15;

pci=0;

do i=1 to 15;

if dxtrialpci{i} in ('0066', '3604', '3606', '3607')

then pci=1;

end;

But NOW i need to include a statement that will take care of missing cases. I want PCI, to be coded as " . ", if all 15 variables PR1-PR15 have no data listed or have "blanks".

I am not sure where and what staement to include in this array, which will help me with missing cases..

Any idea about how to do this?

Any help will be appreciated..

Thanks

Ashwini

RichardinOz
Quartz | Level 8

You can use the CATS function to concatenate character variables and strip leading and trailing blanks, so if you concatenate all dxtrailpci values and come up with a blank then none of them hav enon blank values

Try this

data library.nismicathcabg4;

    set library.nismicathcabg4;

    array dxtrialpci{15} pr1-pr15;

    length anydxtrialpci $ 4 ;

    pci=0;

    do i=1 to 15;

    if dxtrialpci{i} in ('0066', '3604', '3606', '3607')

      then pci=1;

    anydxtrialpci = CATS (anydxtrialpci, dxtrialpci{i}) ;

    end;

    if anydxtrialpci = ' '

      then pci = . ;

run ;

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 ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 26 replies
  • 2449 views
  • 0 likes
  • 6 in conversation