
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 1188 04-19-2023 06:39 PM 4537 11-24-2022 09:18 PM 4599 11-24-2022 10:37 AM 4599 11-24-2022 10:36 AM 4601 11-24-2022 10:33 AM 4684 11-24-2022 12:27 AM 1522 11-08-2021 08:17 PM 1548 11-08-2021 08:10 PM 1560 11-08-2021 07:11 PM 5885 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
08-11-2014
01:12 PM
I am starting to think about what you posted. Sadly a simple copy and paste did not work. So I am starting to think about having a first combination of ID and visit, since that is how the record is uniquely identified, but I do somewhat understand your approach to this issue. Also ID variable is numeric so can't use length.
... View more
08-11-2014
01:02 PM
reason why I am using a macro approach is i have to do this for about 30 difference scores
... View more
08-11-2014
11:58 AM
So my dataset is in long format. I am trying to calculate the change of scores from baseline. I have created the following macro: %MACRO CHANGE(score,var); if visit=1 then &score._bl=&score; retain &score._bl; else &score._chg=&score-&score._bl; label &score._bl="&var at baseline" &score._chg="Change in &var from baseline"; %MEND CHANGE; So the issue I am running into, is that if a patient did not have baseline (visit) assessment, the code takes the last known baseline value from another patient, which I do not want. This is my sample data (based after running the macro above and looking at my data): ID Visit Score (&score) Score at Baseline (&score._bl) Change in Score from Baseline 1 1 12.5 12.5 1 2 20 12.5 7.5 2 2 26 12.5 13.5 So as you can see highlighted in red, ID=2 did not have a visit 1, he joined the study at visit 2. But when the macro calculated the change of score, the previous retained value is used. THis is not right. Is there a way I can fix this? Alternatively, I can create a new dataset with just the baseline values by ID, rename the variables and merge it back in. But I am hoping there is a more efficient way to do this. Reason why I am using a macro approach is because I will be doing this with multiple scores. I would like to thank everyone in advanced who provided feedback on this.
... View more
05-12-2014
03:06 PM
So I have a variable called cumlative dosage. I want to code a patient to see if they are above or the below the median dosage. So when I run: proc means data=temp n min max median; var avcumdos_6wper; run; This is the following output N Minimum Maximum Median ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ 184 1.1695906 10.4000000 4.0354701 ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ So I want to calculate a flag variable around that mean. where flag=. if avcumdos_6wper=., flag=1 if avcumdos_6wper <= median or flag=2 if avcumdos_6wper> median. So I figure I can do this via sql, but i can't seem to get it to work. It just copies the variable. This is my code thus far: proc sql; create table temp1 as select patientid, visit, avcumdos_6wper, median(avcumdos_6wper) as mv, case when avcumdos_6wper = . then . when avcumdos_6wper <= calculated mv then 1 when avcumdos_6wper > calculated mv then 2 else 999 end as flag from temp; Can someone tell me what I am doing wrong?
... View more
05-05-2014
03:07 PM
Thanks for this. Your links actually led me to figure out why it is doing this. It turns out that the SAS server I was on, the administrator specified a specific SAS location for another department (long story, but I'm the only one in the US in my department that uses SAS, so I'm using another's US Department's SAS server). From reading around the links you provided and the links those links provided, I figured out that the fonts I was using was not registered in SAS, therefore I had to manually registered the fonts. It was weird to me that on a Windows machine, the program could not recognized Arial. So my follow up question, where does SAS store its default font. I am still missing Albany AMT and I do not see it in the Windows default font folder (C:\Windows\Font)? So basically the 'core\printing\freetype\fonts' location.. I did try looking at SASfoundation\9.2\Core, but the printing folder does not exist..
... View more
05-05-2014
10:30 AM
I am running into some issues with fonts on our SAS server. This is the warning I am getting: goptions reset=all devmap=winansi keymap=winansi hsize=28cm vsize=13cm; ods rtf prepage="&graphtitle"; PROC GPLOT DATA=cumul annotate=anno5; PLOT cum_pct*patcipn20_SS_chg=study_treat/legend=legend1 vaxis=axis1 haxis=axis2; RUN; WARNING: Font Albany AMT/bo could not be used. Font SIMULATE substituted for font Albany AMT/bo. WARNING: Font Arial could not be used. Font SIMULATE substituted for font Arial. WARNING: Font Arial could not be used. Font SIMULATE substituted for font Arial. WARNING: Font Arial could not be used. Font SIMULATE substituted for font Arial. So from there, I have checked for the fonts by running the following code: proc registry list startat='core\printing\freetype\fonts';run; I do see Albany AMT and Arial installed. So I do not know what to make of this. I did add the gooptions to reset all options (based on a google search) to try to fix the issue, but that did not work. Anyone have any thoughts? Thanks!
... View more
03-26-2014
10:41 AM
I have recently started working for a big company. I am the only SAS user in my department so I am using another's department SAS server license by remote desktop into their servers. It seem that this other department has SAS by default load a configuration file at start up. Are there any commands with a SAS shortcut I create to ignore the configuration files? This is what I see in the log file when I load up SAS: NOTE: Unable to open SASUSER.REGSTRY. WORK.REGSTRY will be opened instead. NOTE: All registry changes will be lost at the end of the session. WARNING: Unable to copy SASUSER registry to WORK registry. Because of this, you will not see registry customizations during this session. NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead. NOTE: All profile changes will be lost at the end of the session. NOTE: This SAS session is using a registry in WORK. All changes will be lost at the end of this session. NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead. NOTE: All profile changes will be lost at the end of the session. NOTE: AUTOEXEC processing beginning; file is C:\Program Files\SAS\SASFoundation\9.2\autoexec.sas. NOTE: Libref GLOBTMPL was successfully assigned as follows: Engine: V9 Physical Name: d:\sasprog\templates ERROR: CLI error trying to establish connection: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database "XXXXXX" requested by the login. The login failed. ERROR: Error in the LIBNAME statement. NOTE: AUTOEXEC processing completed.
... View more
03-26-2014
10:27 AM
I am trying to figure out how exactly to fix this issue. So I am running a SAS server program (remote desktop into a Windows server machine.. use SAS from there). I am trying to do a 4 way interaction to check my code to ensure I created my variables correctly and I seem to get an error 6674 proc freq data=disease; 6675 table time_diag*date_screen*date_diag*diagy / list missing; 6676 run; ERROR: Unable to allocate sufficient memory. At least 725504K bytes were requested. You must either increase the amount of memory available, or approach the problem differently. I do not have admin access to the server. Does anyone know any work around to get this to run?
... View more
03-13-2014
09:21 AM
So I am writing a code and I seem to be stuck. I have been searching through google and haven't been able to find an answer. So I am hoping someone here can advise me. I am trying to pick the last non-missing value. This is my data data has; input ID RX Time score; datalines; 1 1 6 10 1 1 12 50 1 1 15 60 2 1 6 10 2 1 12 50 2 1 15 . ; I want to subset the data to pick only last time point that does not have a missing score. So for ID 1, I want to pick the record at time 15 since it is the last non-missing score. and for ID 2 i want to pick the record with time 12 since the score is missing at time 15. The code I have come up with so far can only pick the last ID if it is not missing: PROC SORT DATA=has; BY ID Time ; RUN; DATA want; SET has; BY ID Time ; if last.id and score NE . then select=1; RUN; What else do I have to do to get my program to work?
... View more
12-03-2013
12:00 PM
I am very new to Macros and I have a quick question.. How do I input in two variables in a macro? %MACRO Table2adj (exp=); PROC SURVEYLOGISTIC DATA =temp nomcar; STRATA sdmvstra; CLUSTER sdmvpsu; WEIGHT MEC10YR; DOMAIN sel; CLASS &exp (REF='0') agegp (ref='3.30-39') martial (REF='4.never married') race (REF='1.NH White') edu (REF='HS') employ (REF='0') income (REF='55+') healthstatus (REF='good') alcohol_abuse (REF='1.Low/No Risk') smoke (REF='0.never smoke') drug (REF='0'); MODEL haveins (event='1')= &exp agegp martial race edu employ income healthstatus Charlston_Score /clparm vadjust=none; run; PROC SURVEYLOGISTIC DATA =temp nomcar; STRATA sdmvstra; CLUSTER sdmvpsu; WEIGHT MEC10YR; DOMAIN sel; CLASS &exp (REF='0') agegp (ref='3.30-39') martial (REF='4.never married') race (REF='1.NH White') edu (REF='HS') employ (REF='0') income (REF='55+') healthstatus (REF='good') alcohol_abuse (REF='1.Low/No Risk') smoke (REF='0.never smoke') drug (REF='0'); MODEL healthvisit (event='1')= &exp agegp martial race edu employ income healthstatus Charlston_Score /clparm vadjust=none; run; %MEND Table2adj; %Table2adj(exp=Male); So the code above, I inserted the variable Male for &exp.. The two proc surveylogistic are identical with exception of the outcome. So I am wondering is there a way to insert Male and insert healthvisit? This is a simplified example, I have multiple procs to run.
... View more
10-31-2013
11:30 AM
Thanks! I this works... but is there a way to have the best of both worlds.. not having to type in the format in the class statement AND have it output with formats?
... View more
10-30-2013
07:07 PM
I am running Proc Logistic. is there a way to run the class statement by putting the value instead of the format name? So in order to get my command to work I had to run the following: proc logistic data = recode ; class agegp (ref='2.age grp 45-65') sex (ref='1.Male') /param = ref; model Y (event='1. <64') = agegp sex; run; So in this case, agegroup=2 and sex=1 are my reference groups (my format is value.category). I have tried doing the following: proc logistic data = recode ; class agegp (ref=2) sex (ref=1) /param = ref; model Y (event=1) = agegp sex; run; The code above gives me a syntax error. I am hoping to avoid copying and pasting the format names. And hopefully make my code shorter.
... View more
10-30-2013
02:13 PM
So this might be a simple and basic question, but I can't find an answer from searching online if Var1 in (1 2 3) then var2=1; so in the code above the IN is include. But is there one that is "not include"? Typically I would not use this on a if statement, but more of a where statement when running a proc freq for example. I know I can do Var1 NE 0 AND VAR1 NE 4 for example, but wondering if there is a way to list it like I did above
... View more
09-26-2013
03:02 PM
Hello So I just received a dataset with formats from someone. I can't seem to read in the formats. I have received 2 files data.sas7bdat and formats.sas7bcat. So I wrote the following code: LIBNAME TCCTM 'C:\Data'; LIBNAME TCCTMFMT 'C:\Data'; proc format Library=TCCTMFMT.formats; run; It ran with no error. But when I open up the dataset I get a series of "Errors: Format FORMAT1 not found or couldn't be loaded for variable VAR1." I have also tried the CNTLIN command instead of the library command and I get the following error: ERROR: File TCCTM.FORMATS.DATA does not exist. I did open the format file in SAS (using the SAS explorer), I see the FORMAT1 does exist in the file. So I am thinking I am reading in the format incorrectly. Can someone tell me how to do it correctly? In addition, how can I tell what value is associated with each format? for example, if the format for education is 1=high school, 2=college 3=grad school.. I know with formats, I will only see the naming. How do I see numerical value associated with the format without removing the format? Thanks!
... View more
07-11-2013
12:34 PM
So I don't know anything about do loops. Would the do loop you written, work for consecutive months? Just reading the code, I think I need to read up on do loops and have a better undertanding on what the code is doing itself. I'm out of the office today and would play with that tomorrow
... View more
- « Previous
- Next »