02-27-2021
asgee
Obsidian | Level 7
Member since
01-22-2020
- 38 Posts
- 28 Likes Given
- 0 Solutions
- 1 Likes Received
-
Latest posts by asgee
Subject Views Posted 1703 02-26-2021 09:16 PM 1728 02-26-2021 08:27 PM 5088 01-02-2021 07:20 PM 5100 01-02-2021 07:02 PM 5124 01-02-2021 06:40 PM 5130 01-02-2021 06:35 PM 5133 01-02-2021 06:28 PM 5224 01-02-2021 05:28 PM 1056 12-03-2020 04:02 PM 795 11-09-2020 03:03 PM -
Activity Feed for asgee
- Got a Like for How do I delete multiple observations/rows based on one instance of a variable?. 07-07-2022 10:20 AM
- Liked Re: How to merge two datasets based on exact values across multiple variables? for mkeintz. 02-26-2021 09:32 PM
- Posted Re: How to merge two datasets based on exact values across multiple variables? on SAS Programming. 02-26-2021 09:16 PM
- Posted How to merge two datasets based on exact values across multiple variables? on SAS Programming. 02-26-2021 08:27 PM
- Posted Re: How do I detect and subset non-missing observations in repeated data (missing -> non-missing) on SAS Programming. 01-02-2021 07:20 PM
- Liked Re: How do I detect and subset non-missing observations in repeated data (missing -> non-missing) for novinosrin. 01-02-2021 07:19 PM
- Posted Re: How do I detect and subset non-missing observations in repeated data (missing -> non-missing) on SAS Programming. 01-02-2021 07:02 PM
- Liked Re: How do I detect and subset non-missing observations in repeated data (missing -> non-missing) for novinosrin. 01-02-2021 07:02 PM
- Posted Re: How do I detect and subset non-missing observations in repeated data (missing -> non-missing) on SAS Programming. 01-02-2021 06:40 PM
- Posted Re: How do I detect and subset non-missing observations in repeated data (missing -> non-missing) on SAS Programming. 01-02-2021 06:35 PM
- Liked Re: How do I detect and subset non-missing observations in repeated data (missing -> non-missing) for novinosrin. 01-02-2021 06:35 PM
- Liked Re: How do I detect and subset non-missing observations in repeated data (missing -> non-missing) for PaigeMiller. 01-02-2021 06:29 PM
- Posted Re: How do I detect and subset non-missing observations in repeated data (missing -> non-missing) on SAS Programming. 01-02-2021 06:28 PM
- Posted How do I detect and subset non-missing observations in repeated data (missing -> non-missing)? on SAS Programming. 01-02-2021 05:28 PM
- Liked Re: Merging by adding rows on repeated data for ballardw. 12-03-2020 05:11 PM
- Posted Merging by adding rows on repeated data on New SAS User. 12-03-2020 04:02 PM
- Liked Re: How do I interpret spline range estimates? for Rick_SAS. 11-16-2020 10:44 AM
- Posted How do I interpret spline range estimates? on SAS Programming. 11-09-2020 03:03 PM
- Posted Re: How to plot Restricted Cubic Spline in PROC LOGISTIC (BY IMPUTATION) on Statistical Procedures. 11-08-2020 02:59 PM
- Liked Re: How to plot Restricted Cubic Spline in PROC LOGISTIC (BY IMPUTATION) for Rick_SAS. 11-08-2020 02:59 PM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 1 1 1 -
My Liked Posts
Subject Likes Posted 1 10-18-2020 07:10 PM
08-31-2024
11:43 PM
In addition to plotting, there is another subtlety I am interested in. That concerns the generation of spline effects themselves. Based on your code, restricted cubic splines are created after the imputation is done. I wonder if you included spline effects when you are imputing. If not, I am also concerned upon how this may have an impact upon your analytical results, as the majority of research paperes (e.g., Multiple imputation of missing data under missing at random: compatible imputation models are not sufficient to avoid bias if they are mis-specified - ScienceDirect) have shown that omission of nonlinear and interaction terms in the imputation stage and simply creat them on-the-spot in the analytical stage will cause biased-toward-zero results (i.e., the regression coefficients are biased toward zero). But, there are also research papers showing that creating them in an ad hoc manner may be a better choice in certain circumstances (e.g., Navigating choices when applying multiple imputation in the presence of multi-level categorical interaction effects - ScienceDirect). I personally have not yet retrieved any research paper specifically showing how spline terms, as a special and rather sophisticated kind of nonlinear term, should be dealt with in missing data. After all, creating them on-the-spot is rather easy and certain researchers (me included) are prone to adopt it had it been proved to be a viable approach.
... View more
02-26-2021
09:16 PM
Hi @mkeintz ! Thanks for the reply. I see what you mean. I think I like your idea of doing the SQL commands instead since that's exactly what I was trying to go for (same values across each of the 5 vars).
Thanks, will try it out myself!
... View more
01-02-2021
10:58 PM
data have;
input ID Time $ Data;
cards;
1234
T1
1
1234
T2
1
5555
T1
0
6777
T2
.
9876
T1
0
9876
T2
0
1000
T1
1
2000
T2
1
8888
T1
1
8888
T2
.
9000
T1
0
9000
T2
.
1010
T1
.
1010
T2
.
;
data temp;
set have;
missing=missing(data);
run;
proc sort data=temp;by id descending missing time;run;
data want;
set temp;
by id;
if last.id;
run;
... View more
12-03-2020
04:47 PM
1 Like
data want;
set data1
data2
;
run;
And what was in your existing Have data set????? Interaction between more than one SET and/or MERGE statement is not a beginner exercise.
You are appending (stacking) data. SAS MERGE if for sidewise combinations to align additional (usually) variables on the same row with common key values. Though if none of the key values match between the two sets Merge will look the same.
Any time you combine multiple data sets variables of the same name should be made to have the same type (all numeric or all character for common names) or the process will fail. If they have different lengths you will get a message like that and may get data truncated depending on orders of things. (Can't fit 10 letters into a space that is expecting 5).
And usually easier to sort afterwards.
... View more
11-10-2020
09:05 AM
1 Like
It is not a dumb question. For the interpretation of what each spline component means, see "Visualize a regression with splines."
... View more
11-04-2020
08:59 PM
Hi @Reeza! Thanks for your reply. Yeah I completely missed that seemingly small yet very important detail of checking to see whether my variable was character or numeric. Seems like that was def the issue. I ended up continuing on with the code I created and it seemed to create the plots I want. Thanks again for your help!!
... View more
10-24-2020
11:31 PM
Ah sounds good, ty again!
... View more
10-21-2020
05:26 PM
Hi @novinosrin (& @Reeza), thanks for your help, the code works perfectly! Ahahah both you and Reeza are amazing intelligent people, can't thank you enough both for all your help.
... View more
10-20-2020
03:21 PM
A SQL DELETE statement will remove rows from the data set without rewriting the whole table.
proc sql undo_policy=none;
delete from have
where ID in
(select ID from have where label='XY')
;
quit;
... View more
10-19-2020
05:10 PM
1 Like
@asgee wrote: Hi @Reeza ! Thanks for the reply. Yes it seems like your code works perfectly! I never came across the "HAVING" clause so that's really good to know. Could there also be a "NOT HAVING" clause if I wanted to subset the opposite?
Try it and let us know 🙂
... View more
09-10-2020
04:03 PM
1 Like
@asgee wrote:
Thanks for this solution @ballardw ! I didn't know there was a SAS function that could indicate the "last" row of the id etc. Works fine and got my expected output.
The sort prior to this by id and visit really helped!
If you data is grouped, especially by an order that would not be duplicated with proc sort, by some variable but not sorted the BY can still be used if you use NOTSORTED option on the BY statement.
There is also an automatic First. that can be used to set/ reset values when processing. Each variable on the BY statement in a data step gets its own First. and Last variable setting so some pretty complicated, and admittedly confusing at first, things can be done. It may also be helpful to know that if a value only appears once it is both First and Last on the same record.
... View more
03-02-2020
03:39 PM
@Tom Thanks so much! Works perfectly 🙂
... View more
02-24-2020
03:20 PM
Hi @novinosrin Yes this is exactly what I'm looking for! Thanks for your help!
... View more
01-30-2020
02:57 AM
Hi Asgee, You can use proc SQL to keep only the repeating ids and then use Proc Freq to get the count of ID's. data have;
input id $ date_test:mmddyy8. test_Date;
format date_test mmddyy8.;
datalines;
ABC 01/08/2020 0.231
ABC 02/02/2020 0.523
ABC 03/04/2020 0.146
GG 01/15/2020 0.875
GG 02/14/2020 0.345
DEF 01/11/2020 0.383
DEF 02/05/2020 0.825
LIN 01/30/2020 0.622
;
run;
proc sort data=have nouniquekeys out=alldups uniqueout=uniques;
by id;
run;
proc freq data=alldups noprint;
tables id / out=want(drop=percent);
run; Hope this helps. Check out my article on Proc Sort.
... View more
01-22-2020
10:50 AM
1 Like
The KEEP statement is not an executable statement - it tells SAS what variables to include in the output data set. And because it is the sas compiler (not the executor) that honors your KEEP statement (see below), it is a standalone statement - it can't be the result of an IF test.
data want;
set sashelp.class;
keep name sex age;
run;
In other words, KEEP is not the opposite of DELETE. You want the OUTPUT statement.
... View more