12-02-2022
EpiNovice
Calcite | Level 5
Member since
04-02-2019
- 21 Posts
- 0 Likes Given
- 0 Solutions
- 0 Likes Received
-
Latest posts by EpiNovice
Subject Views Posted 461 11-02-2022 10:55 AM 3293 07-13-2022 03:06 PM 603 06-16-2022 12:36 PM 621 06-16-2022 11:43 AM 2384 01-11-2021 10:49 PM 2456 01-11-2021 07:56 PM 665 11-11-2020 08:52 PM 744 03-30-2020 10:17 PM 821 03-30-2020 03:34 PM 514 11-13-2019 11:13 AM -
Activity Feed for EpiNovice
- Posted Taking the mean of values from long form data on SAS Programming. 11-02-2022 10:55 AM
- Posted Table 1 output using results from proc freq and univariate on SAS Programming. 07-13-2022 03:06 PM
- Posted Re: Do loop to carry variable across IDs not working on SAS Programming. 06-16-2022 12:36 PM
- Posted Do loop to carry variable across IDs not working on SAS Programming. 06-16-2022 11:43 AM
- Posted Re: Retain statement-- previous row value based on two other variables on SAS Programming. 01-11-2021 10:49 PM
- Posted Retain statement-- previous row value based on two other variables on SAS Programming. 01-11-2021 07:56 PM
- Posted Create a variable using date ranges within date ranges on SAS Programming. 11-11-2020 08:52 PM
- Posted Re: Carry constant values (ie. sex) across multiple participant entries in long form data on SAS Programming. 03-30-2020 10:17 PM
- Posted Carry constant values (ie. sex) across multiple participant entries in long form data on SAS Programming. 03-30-2020 03:34 PM
- Posted Writing Estimate Statements and Interpreting Poisson Output on Statistical Procedures. 11-13-2019 11:13 AM
- Posted Negative Binomial and Incidence on Statistical Procedures. 11-06-2019 10:34 PM
- Posted Re: newly created data "not a SAS data set" on SAS Programming. 07-02-2019 10:07 AM
- Posted Re: newly created data "not a SAS data set" on SAS Programming. 07-02-2019 10:01 AM
- Posted newly created data "not a SAS data set" on SAS Programming. 07-02-2019 09:44 AM
- Posted Difficulties with REDCap data in SAS on SAS Data Management. 04-12-2019 03:43 PM
- Posted Re: Date equations in long form data on SAS Programming. 04-02-2019 04:29 PM
- Posted Re: Date equations in long form data on SAS Programming. 04-02-2019 02:17 PM
- Posted Re: Date equations in long form data on SAS Programming. 04-02-2019 02:06 PM
- Posted Re: Date equations in long form data on SAS Programming. 04-02-2019 01:59 PM
- Posted Re: Date equations in long form data on SAS Programming. 04-02-2019 01:57 PM
11-02-2022
10:55 AM
Good morning, I need help with code to create a variable that is the mean of a series of values from a long data set. For example, the data I have looks like this: ID Event Time (ms) 1 A 1.2 1 B 3.3 1 A 1.1 1 B 2.3 1 A 0.9 1 B 1.9 1 A 1.4 2 A 2.3 2 B 3.2 2 A 1.9 2 B 2.8 2 A 1.7 2 B 3.1 And what I need is data that looks like this: ID Event Mean time (ms) 1 A 1.14 1 B 2.43 2 A 1.95 2 B 3.03 Do I need to reformat to wide dataset to accomplish this, or is there another way? Thanks in advance!
... View more
07-13-2022
03:06 PM
Good afternoon, I'd like to write some code that will prepopulate a Table 1 for an academic journal with summary data from Proc Freq, Proc Univariate, etc, but I've never seen anything I can modify for this purpose. I assume this could be accomplished with a macro that outputs the results to Excel, but I have no idea where to start. The table would ideally look something like this: Variable Name Category 1 Categeory 2 P-value Variable 1 1 N(%) N(%) Chi-sq or Fisher's 2 N(%) N(%) 3 N(%) N(%) Variable 2 Mean (SD) Mean (SD) t-test Median (IQR) Median (IQR) Thanks in advance!
... View more
06-16-2022
12:36 PM
Worked like a charm, thanks!!
... View more
06-16-2022
11:43 AM
Hi Everyone, I'm trying to carry a visit date across all rows of each participant ID, to create a start date column. I've used the below code to carry values across IDs in other coding, but now it just keeps telling me that _id is uninitialized. Is there something I'm missing? Is there a better way to do this? Code: data TOSStart(drop=_:); do until (last.id); set toscount; by id; if id > _id then do; _Start = Start; end; end; do until (last.id); set toscount; by id; Start = _Start; output; end; run; Have this: ID Start 1 1/1/2022 1 1 1 4 3/5/2022 4 4 6 2/8/2022 6 6 6 6 6 6 Want this: ID Start 1 1/1/2022 1 1/1/2022 1 1/1/2022 1 1/1/2022 4 3/5/2022 4 3/5/2022 4 3/5/2022 6 2/8/2022 6 2/8/2022 6 2/8/2022 6 2/8/2022 6 2/8/2022 6 2/8/2022 6 2/8/2022 Thanks!
... View more
01-11-2021
10:49 PM
This worked beautifully, thank you!!
... View more
01-11-2021
07:56 PM
Data sample: ID Test VisitType 1 0 S 1 1 S 1 1 U 1 0 S 1 1 S 1 1 S 1 1 S 2 1 S 2 1 S 2 0 S 2 1 S 2 1 U 2 1 U 2 1 U 2 1 U 2 0 S 2 0 S 2 0 S Based on the above data, I'm trying to create a variable (VarWant) that, for each ID, is a 1 if VisitType=S and Test=1 OR is a 1 if VisitType=S, Test=0, BUT the preceding VisitType=U and Test=1. For clarification, here is what I'm looking for: ID Test VisitType VarWant 1 0 S 0 1 1 S 1 1 1 U 1 1 0 S 1 1 1 S 1 1 1 S 1 1 1 S 1 2 1 S 1 2 1 S 1 2 0 S 0 2 1 S 1 2 1 U 1 2 1 U 1 2 1 U 1 2 1 U 1 2 0 S 1 2 0 S 0 2 0 S 0 I know I can use a retain statement for this, but I can't figure out the logic statement that should accompany it. Thanks in advance for the help!
... View more
11-11-2020
08:52 PM
I'm trying to create a new variable that shows what proportion of follow-up time for each participant was during a rainy season, but I'm not sure how to do it. Below is an example of my data. FUStart= Start of follow-up FUEnd=End of follow-up The next 4 columns show the dates for the start and end of the rainy seasons that occurred over the course of follow-up. I know how to calculate the length of follow-up, but I don't know how to structure an if/then statement to determine how much of the rainy season fell in that period. In short, how do I use these dates to count the number of follow-up days that were in a rainy season? Thanks in advance for any thoughts! PID FUStart FUEnd Rain1Start Rain1End Rain2Start Rain2End RainyDaysFU 1 01/27/18 05/10/19 11/01/17 04/30/18 11/01/18 04/30/19 ? 2 01/12/18 05/08/19 11/01/17 04/30/18 11/01/18 04/30/19 ? 3 09/26/17 01/30/18 11/01/17 04/30/18 11/01/18 04/30/19 ? 4 12/10/17 01/23/18 11/01/17 04/30/18 11/01/18 04/30/19 ? 5 07/16/17 01/30/18 11/01/17 04/30/18 11/01/18 04/30/19 ? 6 05/03/18 05/17/19 11/01/17 04/30/18 11/01/18 04/30/19 ? 7 08/11/18 05/13/19 11/01/17 04/30/18 11/01/18 04/30/19 ?
... View more
03-30-2020
10:17 PM
Thanks, this did the trick!
... View more
03-30-2020
03:34 PM
Good afternoon, I have data with multiple entries per participant, but certain variables only have values at the last visit. Unfortunately that last visit has a different name and date for each participant. Additionally there is a different number of visits for each participant. I've ranked the visits and would like to carry the values for sex and study arm from the last visit across all the visits. How can I do this? In the past I've carried values for dates using something like this: data C; set B; Keep ID event_name DOB var4 var5 var6; merge B(where=(event_name= 'delivery') rename=(DOB=DOB1)) A; by ID; run; I can't figure out how to make this work without a constant value for the where statement. For clarity, what I have looks something like this: ID count Sex Study Arm 1 1 . . 1 … . . 1 7 2 2 4 1 . . 4 2 . . 4 3 . . 4 … . . 4 18 1 1 8 1 . . 8 2 . . 8 3 . . 8 … . . 8 18 2 1 13 1 . . 13 2 . . 13 3 . . 13 … . . 13 14 2 2 15 1 . . 15 2 . . 15 3 . . 15 4 . . 15 5 1 2 And I'd like it to look like this: ID count Sex Study Arm 1 1 2 2 1 … 2 2 1 7 2 2 4 1 1 1 4 2 1 1 4 3 1 1 4 … 1 1 4 18 1 1 8 1 2 1 8 2 2 1 8 3 2 1 8 … 2 1 8 18 2 1 13 1 2 2 13 2 2 2 13 3 2 2 13 … 2 2 13 14 2 2 15 1 1 2 15 2 1 2 15 3 1 2 15 4 1 2 15 5 1 2
... View more
11-13-2019
11:13 AM
Hello everyone, I'm trying to understand estimate statements and I'm really struggling, so I hope you can assist! My variables are as follows: Outcome: incidence of events per person-year Disease (yes=1, no=0) Sex (male= 1, female=0) Study site (L= 1, M=3) Season (1, 2, 3, 4) Age (1, 2, 3) I understand how to use proc Genmod to estimate betas, but I'm trying to estimate crude rate ratios for each variable and then the rate ratios for an adjusted model with multiple variables. What would estimate statement look like comparing males to females? Season 3 to the rest? For the adjusted model, would I just be better off calculating it using the betas? Finally, regarding how to interpret the parameter estimates provided in the absence of estimate statements-- If I have output that gives me a parameter estimate of 0.1493 (95% CI: -0.0823, 0.3809) for sex=0, and I exponentiate the estimate, is it correct to say "females are expected to have 1.41 (95% CI: 0.83, 2.40) more events than males per person-year"? Thanks in advance for the guidance!
... View more
11-06-2019
10:34 PM
Hi everyone: I'd like to calculate incidence rates. I know it can be done using Proc GENMOD with Poisson and lsmeans, however my data is over-dispersed and it looks like negative binomial is the way I need to go. Is there a way to calculate incidence using negative binomial in Proc GENMOD? My variables are as follows: Events: dependent variable, gives a count of events per 1000 person days Disease: predictor variable, yes/no Days: days of follow-up I'd like the incidence for the whole group as well as stratified by disease status. Suggestions? Thanks in advance!
... View more
07-02-2019
10:07 AM
This is what happens when I run the libname: 14385 DM log 'clear'; 14386 DM out 'clear'; 14387 14388 libname thesis 'C:\Users\name\Documents\Dissertation\Data'; NOTE: Libref THESIS refers to the same physical library as LIWONDE. NOTE: Libref THESIS was successfully assigned as follows: Engine: V9 Physical Name: C:\Users\name\Documents\Dissertation\Data 14389 data thesis.Aim1; 14390 set work.aim1; 14391 run; ERROR: File THESIS.AIM1.DATA is not a SAS data set. NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds I'm running the program on my laptop without using an outside server and it's not university edition.
... View more
07-02-2019
10:01 AM
proc print shows me exactly what I would expect to see from a data set.
... View more
07-02-2019
09:44 AM
Hi everyone, I keep running into this issue: I've gone through all the steps of creating a data set, I've used a libname statement, I try to save the new data to my folder and I get the error that: ERROR: File THESIS.AIM1.DATA is not a SAS data set. Code looks like this: libname thesis 'C:\Users\name\Documents\Dissertation\Data'; /****** lots of data manipulation to create clean data set ****/ /***** EXPORT AIM1 DATA *****/ data thesis.Aim1; set work.aim1; run; And then I get the error. I should add, the work file is just fine and can be used for analysis with no issue. So why won't it save to my computer folder? Thanks in advance!
... View more
04-12-2019
03:43 PM
Has anyone who uses REDCap had an issue with inputting data using the code provided by REDCap? Specifically with dates not loading properly. If I use the Path Mapper file provided, everything seems to load fine. My issue is that I don't have that for every data set, I just have the CSV file and if I try to load it with the SAS code provided it says I have "invalid data" for every single date variable. Is there any way to fix this?
... View more