Recently in the SAS Community Library: Transposing data is useful when your data structure conflicts with your analysis needs. For example, transposing time series data can make trend analysis and forecasting easier, and customer transactional data is often transposed to enhance customer segmentation and targeting processes. In this article, SAS' @SASJedidiscusses the “tools of the trade” for SAS programmers. Specifically: PROC TRANSPOSE and DATA step with arrays and DO Loops.
Hello, I was wondering if it's possible to view the SAS Stored Processes Usage anywhere. We have a bunch of stored processes and would like to see how many times they are run, the most run report, and who are the power users. Is there any macro that exists? In SQL Server it's possible to query the execution log and get a bunch of information on reports and users, does the same exist in SAS? Thank you.
... View more
Dear SAS community,
Since the lsmeans/ilink option is not supported in proc logistic when the predictor var is continuous, I tried the following estimates:
My outcome var is ordinal (1,2,3,4,5,6,7,8,9) and my predictor DM continuous. I would like to know the predicted prob for hedonic=5 and 6 at DM=22.8.
proc logistic data=one desc; model hedonic= DM/link=clogit; estimate "Pr prob hedonic=5 at DM=22.8" intercept 1 DM 22.8/ilink category='5'; estimate "Pr prob hedonic=6 at DM=22.8" intercept 1 DM 22.8/ilink category='6'; run;
I would greatly appreciate if you could let me know if this looks ok to you.
Thanks a lot!
... View more
I have a large dataset with several variables. Where record=C, this is the current accepted Label value. Where record=H these are historical labels.
I am having trouble figuring out how to produce a new dataset with the label for every ID that is current (i.e., where record=C), but also if there was a change in label during the time period. Obviously getting where records=C is easy, but that 'if there record value changed during the set time period' part is tripping me up.
In other words, if there were historical changes but the label didn't change, then only the current record is desired. If there was a label change I would want both the current and the historical record to see what the label was changed from .
Time period of interest 2018-01-01 through 2023-12-31 (*note, present record dtend=9999-12-31)
data have;
input record $ label $ dtstart :yymmdd10. dtend :yymmdd10. id;
format dtstart yymmdd10. dtend yymmdd10.;
datalines;
H WA123 2010-01-01 2018-07-05 1
C WA123 2018-07-06 9999-12-31 1
H AJ456 2015-02-15 2019-10-30 2
H AJ456 2019-10-31 2022-12-31 2
C AJ456 2023-01-01 9999-12-31 2
H AJ123 2000-01-25 2010-08-20 3
H AJ123 2010-08-21 2020-09-01 3
C AJ124 2020-09-02 9999-12-31 3
;
RUN;
data want;
input record $ label $ dtstart :yymmdd10. dtend :yymmdd10. id changeflag;
format dtstart yymmdd10. dtend yymmdd10.;
datalines;
C WA123 2018-07-06 9999-12-31 1 0
C AJ456 2023-01-01 9999-12-31 2 0
H AJ123 2010-08-21 2020-09-01 3 1
C AJ124 2020-09-02 9999-12-31 3 1
;
RUN;
Does my want make sense?
For IDs 1 and 2 : I don't need previous records because label didn't change.
For ID 3 I need the current and the previous record (which I would want flagged as being part of a changed set) because they changed during the time period. The last caveat, if there were multiple label changes in the time period for an ID I would need to see each of them, not just the most recent.
... View more
Hi sas experts, I am looking for a solution that starts from a dummy variable and counts the number of changes from value 0 to 1 during a pre-defined time window (in my case: 6 months) for each subject (id column). The below example shows how the data that I have looks like, (including the col_have) and the outcome column that I want (col_want): data data; input id time date9. col_have col_want; format time date9.; datalines; 1 01DEC2012 1 2 1 01NOV2012 0 1 1 01OCT2012 1 2 1 01SEP2012 0 1 1 01AUG2012 1 1 1 01JUL2012 1 1 1 01JUN2012 1 2 1 01MAY2012 0 1 1 01APR2012 0 1 1 01MAR2012 1 1 1 01FEB2012 1 1 1 01JAN2012 0 0 2 01DEC2013 0 0 2 01NOV2013 0 0 2 01OCT2013 0 1 2 01SEP2013 0 1 2 01AUG2013 0 1 2 01JUL2013 0 2 2 01JUN2013 1 2 2 01MAY2013 0 1 2 01APR2013 1 1 2 01MAR2013 1 1 2 01FEB2013 0 0 2 01JAN2013 1 0 ; run; To give a bit of details, the algo should take each date and count the number of times for which the col_have changes values from 0 to 1 during the last 6 months. Thank you very much in advance for effort and support!
... View more
I am using the SAS OnDemand for Academics (free online version), I have attached a portion of my code. The only error code I am getting is that there is missing or invalid data but I'm not sure where that would be coming from. It will also give a NOTE: Invalid data for DAP in line 144 1-18. which repeats for YEAR in line 145 1-18, PLOT in line 146 1-17, REP in line 147 1-17, TRT in line 148 1-17, NDVI in line 149 1-17 and this pattern repeats through the code. Any advice would be welcome! data alldata;
input DAP YEAR PLOT REP TRT NDVI;
datalines;
114 1 402 4 3 0
114 1 403 4 2 0
114 1 404 4 1 0
125 2 401 4 2 0.855
125 2 402 4 3 0.825
125 2 403 4 4 0.815
119 3 303 3 3 0.69
119 3 304 3 2 0.775
119 3 403 4 4 0.705
;
run;
proc sort data=alldata; BY Year DAP;
proc glimmix data = alldata; BY Year DAP;
class REP TRT;
model NDVI = TRT;
random REP;
lsmeans TRT / lines;
run;
... View more
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9. Sign up by Dec. 31 to get the 2024 rate of just $495. Register now!