
11-30-2023
Tpham
Quartz | Level 8
Member since
04-09-2013
- 84 Posts
- 6 Likes Given
- 1 Solutions
- 2 Likes Received
About
HIV/AIDS, Health Disparities, Health Services Research, Clinical Research, Patient Centered Outcomes, Measurement Theory
-
Latest posts by Tpham
Subject Views Posted 1161 04-19-2023 06:39 PM 4476 11-24-2022 09:18 PM 4538 11-24-2022 10:37 AM 4538 11-24-2022 10:36 AM 4540 11-24-2022 10:33 AM 4623 11-24-2022 12:27 AM 1450 11-08-2021 08:17 PM 1476 11-08-2021 08:10 PM 1488 11-08-2021 07:11 PM 5813 08-11-2021 09:08 AM -
Activity Feed for Tpham
- Posted Proc report, how to apply same compute condition on multiple variables? on SAS Programming. 04-19-2023 06:39 PM
- Got a Like for Proc Report, Merging cells when grouped and vertical center. 01-22-2023 07:18 PM
- Posted Re: How to randomize Subjects into 2 groups and balance based on demographics? on SAS Programming. 11-24-2022 09:18 PM
- Posted Re: How to randomize Subjects into 2 groups and balance based on demographics? on SAS Programming. 11-24-2022 10:37 AM
- Posted Re: How to randomize Subjects into 2 groups and balance based on demographics? on SAS Programming. 11-24-2022 10:36 AM
- Posted Re: How to randomize Subjects into 2 groups and balance based on demographics? on SAS Programming. 11-24-2022 10:33 AM
- Got a Like for How to randomize Subjects into 2 groups and balance based on demographics?. 11-24-2022 01:26 AM
- Posted How to randomize Subjects into 2 groups and balance based on demographics? on SAS Programming. 11-24-2022 12:27 AM
- Posted Re: Adding MS Word Styles in ODS RTF outputs for overall table of contents on ODS and Base Reporting. 11-08-2021 08:17 PM
- Posted Re: Adding MS Word Styles in ODS RTF outputs for overall table of contents on ODS and Base Reporting. 11-08-2021 08:10 PM
- Posted Adding MS Word Styles in ODS RTF outputs for overall table of contents on ODS and Base Reporting. 11-08-2021 07:11 PM
- Posted Is there a method to code automatically save results as lst file when code is finish running? on SAS Programming. 08-11-2021 09:08 AM
- Posted Re: Proc Report: Across scattered on SAS Programming. 06-26-2020 02:35 PM
- Posted Re: Proc Report: Across scattered on SAS Programming. 06-26-2020 12:59 PM
- Tagged Proc Report: Across scattered on SAS Programming. 06-26-2020 12:57 PM
- Posted Proc Report: Across scattered on SAS Programming. 06-26-2020 12:56 PM
- Posted Re: Retain with multiple first statements on SAS Procedures. 04-22-2020 02:57 PM
- Posted Retain with multiple first statements on SAS Procedures. 04-22-2020 02:39 PM
- Liked Re: Easiest way to extract format values from character variable? for PaigeMiller. 01-21-2020 10:45 AM
- Posted Easiest way to extract format values from character variable? on SAS Programming. 01-21-2020 09:14 AM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 1 1 1 -
My Liked Posts
Subject Likes Posted 1 10-05-2016 11:54 AM 1 11-24-2022 12:27 AM
04-19-2023
06:39 PM
This is my code so far
proc report data=report nowindows headline headskip SPANROWS split='|' spacing=4
style(header)={ just=center asis=on}
style(column)={asis=on}
style(report)={width=9 in};
by pageno;
column pageno Varlab PACT_MNGT PACT_SEEKDR PACT_RESP PACT_OTPTS PACT_MED PACT_VIT PACT_INFRMDR PACT_ADHERE PACT_OPTIONS PACT_FACTR PACT_RESRCH;
define pageno / order order=data noprint;
define Varlab /order display "Item" group order = data style(header)=[just=left fontweight=bold asis=on] style(column)=[just=left fontweight=bold asis=on cellwidth=0.5in];
define PACT_MNGT /order display order = data style(header)=[just=left fontweight=bold asis=on] style(column)=[just=left asis=on cellwidth=.25in];
define PACT_SEEKDR /order display order = data style(header)=[just=left fontweight=bold asis=on] style(column)=[just=left asis=on cellwidth=.25in];
define PACT_RESP /order display order = data style(header)=[just=left fontweight=bold asis=on] style(column)=[just=left asis=on cellwidth=.25in];
define PACT_OTPTS /order display order = data style(header)=[just=left fontweight=bold asis=on] style(column)=[just=left asis=on cellwidth=.25in];
define PACT_MED /order display order = data style(header)=[just=left fontweight=bold asis=on] style(column)=[just=left asis=on cellwidth=.25in];
define PACT_VIT /order display order = data style(header)=[just=left fontweight=bold asis=on] style(column)=[just=left asis=on cellwidth=.25in];
define PACT_INFRMDR /order display order = data style(header)=[just=left fontweight=bold asis=on] style(column)=[just=left asis=on cellwidth=.25in];
define PACT_ADHERE /order display order = data style(header)=[just=left fontweight=bold asis=on] style(column)=[just=left asis=on cellwidth=.25in];
define PACT_OPTIONS /order display order = data style(header)=[just=left fontweight=bold asis=on] style(column)=[just=left asis=on cellwidth=.25in];
define PACT_FACTR /order display order = data style(header)=[just=left fontweight=bold asis=on] style(column)=[just=left asis=on cellwidth=.25in];
define PACT_RESRCH /order display order = data style(header)=[just=left fontweight=bold asis=on] style(column)=[just=left asis=on cellwidth=.25in];
compute PACT_MNGT;
if PACT_MNGT GE 0.80 AND PACT_MNGT LT 1 then call define(_col_,"style","style={background=red}");
else if PACT_MNGT LE 0.40 then call define(_col_,"style","style={background=yellow}");
endcomp;
compute PACT_SEEKDR;
if PACT_SEEKDR GE 0.80 AND PACT_SEEKDR LT 1 then call define(_col_,"style","style={background=red}");
else if PACT_SEEKDR NE . AND PACT_SEEKDR LE 0.40 then call define(_col_,"style","style={background=yellow}");
endcomp;
run;
Towards the end, I am applying the same code (in red) to highlight correlations that are GE 0.80 OR LE 0.40 for all 11 item variables. Is there an easy way to do this without copying and pasting each comp/endcomp block and changing the variable within each block in proc report? Basically I am asking, is there a way I can write one comp/endcomp block and apply the same conditional formatting for all 11 PACT variables?
... View more
11-24-2022
09:18 PM
Thanks for your help on this. I've adapted your code and looks like it works!
... View more
11-24-2022
10:37 AM
thanks, in this case, how do I account for characteristics to ensure the 2 groups are the comparable in terms of their demographics in this randomization code? Overall, after the randomization, I would want to show that randomization work.
... View more
11-24-2022
10:36 AM
Added to my post
... View more
11-24-2022
10:33 AM
Added to my post
... View more
11-24-2022
12:27 AM
1 Like
I am working on my doctoral dissertation right now. I have my dataset *wide format, 12,000 subjects) which contains Subject ID, race age and sex for my research study. My goal is to randomize the Subject Ids in my dataset into 2 equal groups (1:1 ratio) and assign each subject to a treatment arm (Group A or Group B) for each subject in my dataset. I would like to have the treatment arm to be closely balanced in race (White, Black, Asian, Other), age (continuous variable) and sex (binary). I assume I need to recode age into age groups of some sort to help with the balance. I have been reading up on randomization methods in SAS and looks like PROC PLAN or PROC SURVEYSELECT is the way to do it. At the moment, I can't figure out the differences between the two approaches, which approach fits would get this task done correctly and how exactly to write my code to create this treatment arm variable. So I was wondering if someone can help me figure out how to do this? I haven't done any type of randomizations before, so I am completely lost here.
Screenshot below is my example, I have the dataset, I want to randomize 12,000 subjects into either group A or Group B and have a that as variable treatment arm. When comparing the group A vs group B: t-test (age) or chi-square (Race/sex), p-value are non-significant. The goal is to make the 2 groups as comparable as possible (e.g. Non-Sig). I know it won't be a perfect non-sig P-value, but overall want it as P>0.05.
... View more
11-08-2021
08:17 PM
log and lst files needs to be saved for each respective program. so the include statement doesn't fully work because of that as I recall.
... View more
11-08-2021
08:10 PM
I'll explore ods word, but however, each code produce its independent table.
BUt yeah, the process I am thinking about is via VBA after adding headers via SAS
... View more
11-08-2021
07:11 PM
I have a number of SAS programs that produce outputs (e.g. table1_1.SAS, Table2_1.SAS etc) using proc report that produce their respective tables (Table 1.1.RTF and Table 2.1.RTF etc.).
I am trying to merge all outputs (so multiple files produced) into one RTF file and have Microsoft word create a table of contents based on headers.
I've found an old paper on adding MS Word Headers into ODS RTF outputs that is based on SAS 8.2+. I'm sure it would work on the modern SAS 9, but I am wondering if there are more modern approaches.
... View more
08-11-2021
09:08 AM
I start all my code by clearing the results fine using "dm 'odsresults; clear';" as specified on this page. I was wondering is there a way to save the results as a lst file (instead of clicking on output, file=>Save AS) via syntax?
I am able to do it for automatically save the log file automatically by using the "DM LOG" command and specifying a file location/name at the end of my code. I can't seem figure out a way to do it for results/LST file, so wondering if anyone can show me how.
... View more
06-26-2020
02:35 PM
Closing this as I figured it out. The had to change week variable from display to analysis
... View more
06-26-2020
12:59 PM
I found this article https://www.lexjansen.com/pharmasug/2012/TF/PharmaSUG-2012-TF20-SAS.pdf
I've tried the dummy variable method and that did not work.
... View more
06-26-2020
12:56 PM
I am new to proc report. Using across to nest two variables together. However, all the results are not on the same row and are scattered
This is what I have:
THis is my code and sample data structure
Data have;
retain IGA group Week1 Week2 CatC CatN;;
length CatC $ 10.;
input IGA group Week1 Week2 CatC $ CatN;
cards;
1 3 . . N 1
1 3 . . Mean 2
2 3 1 1 N 1
2 3 2.3 2.0 Mean 2
3 3 3 3 N 1
3 3 1.9 2.0 Mean 2
4 3 3 3 N 1
4 3 0.9 1.3 Mean 2
5 3 4 4 N 1
5 3 1.7 1.3 Mean 2
;
ods tagsets.rtf file="&path.\output\Draft\&pgm..rtf" style=rtfdef startpage=yes nogtitle nogfootnote;
proc report data=have nowindows headline headskip SPANROWS split='|' spacing=4
style(header)={ just=center asis=on}
style(column)={asis=on}
style(report)={width=9 in};
column group CatN CatC (IGA, (Week1 Week2));
define IGA/across order=data style(header)=[just=center fontweight=bold asis=on] style(column)=[just=center asis=on];
define group/order=data group "Age Group" style(header)=[just=left fontweight=bold asis=on] style(column)=[just=left asis=on cellwidth=0.7in];
define CatN/order=data noprint;
define CatC /display 'Statistic' style(header)=[just=center fontweight=bold asis=on] style(column)=[just=left asis=on cellwidth=0.7in];
define Week1/display style(header)=[just=center fontweight=bold asis=on] style(column)=[just=center asis=on cellwidth=0.7in ];
define Week2/display style(header)=[just=center fontweight=bold asis=on] style(column)=[just=center asis=on cellwidth=0.7in ];
run;
ods tagsets.rtf close;
How do I get all N and mean to report on the same row across the IGA variable and weeks?
... View more
- Tags:
- proc report
04-22-2020
02:57 PM
THanks, this did work for me. So basically, i don't sort it by visit also it looks like.
However, how does SAS know, which is the first visit?
... View more
04-22-2020
02:39 PM
This is the data I have and want.
data want;
input ID visit question response v1_response;
cards;
1 1 1 4 4
1 2 1 3 4
1 1 2 6 6
1 2 2 9 6
;
Basically, I want to create variable v1_response, where it shows the visit 1 response by ID and question in order to calculate the change from visit 1 score for each question. I know how to do this when it is only 1 question in the dataset. But my approach is keeping only the value of the first question across all questions.
This is my code so far
data have;
input ID visit question response;
cards;
1 1 1 4
1 2 1 3
1 1 2 6
1 2 2 9
;
proc sort data=have;
by ID visit question;
run;
data want;
set have;
by ID visit question;
retain v1_response;
if first.ID AND first.question and visit=1 then do;
v1_response=response;
end;
else if visit GT 1 do;
change=response-v1_response;
end;
run;
... View more