Recently in the SAS Community Library: SAS' @BethEbersole reveals 4 steps to stop money laundering, solve law-enforcement cases, find missing children and more with SAS Visual Investigator.
I have a data set with multiple variables (columns). I'm trying to get the top 10 values of each variable. However, I would like the output to be in a new dataset with a new variable called: variable_names. The row shows the top 10 values from smallest to largest. The data below is just an example. I have more than 4 input variables. Here, I am just looking at the top 3. For a bigger data set, I may look at the top 10. data example; input a b c d; datalines; 100 120 123 140 12 23 43 42 12 12 23 23 5 7 5 2 80 88 98 2 3 4 101 4 ; %let nTop = 3; proc univariate data = new_data NExtrObs=&nTop; ods select ExtremeObs; run; The proc univariate gives a separate output for each. The UNIVARIATE Procedure Variable: a Extreme Observations Lowest Highest Value Obs Value Obs 3 6 12 3 5 4 80 5 12 3 100 1 I would like to create a new data set where output with column names: Variables and the top values. For example, Variables Top1 Top2 Top3 a 12 80 100 b 23 88 120 c 5 6 1
... View more
Hello,
I am struggling with controlling page breaks in proc report/ods PDF. I already did a post a few months ago (https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-suppress-table-splitting-in-ODS-PDF/m-p/907292#M26446), but I have not found a solution yet. First, I thought I will just use ods rtf with the keepn option, but that brings more problems than it solves. Now, I have just found a paper that kind of describes the problem from Stetz et al. "Controlling Page Breaks when using Proc Report" (https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://support.sas.com/resources/papers/proceedings-archive/SUGI95/Sugi-95-70%2520Stetz.pdf&ved=2ahUKEwjHib_10PuFAxUi_rsIHa0GA9oQFnoECBAQAw&usg=AOvVaw0Z1J0znhm8-SeB_Oxq4tBr). Unfortunately, the paper is quite short and I do not understand how the data in the example code is structured. My question is: Does anyone have further knowledge on using "line counting" to control page breaks with proc report? Or does anyone know other papers that talk about this issue?
@Cynthia_sas did you write the paper? And if so, have you got any tips for the page break control?
If anyone needs code examples I can provide code and data, but for now I thought it would be more useful if I try different approaches before just posting my code where I did not achieve much yet. I am grateful for any help.
Kind regards
... View more
Hello,
I am running an interaction but need to reorder the x axis variables from how it is displayed below to PRISm, GOLD 0 - GOLD 4. Additionally, I need to change the legend diabetes_P1 to 'diabetes at baseline' and the Title to 'Change in FEV1pp'.
Proc GLM data=working4 (rename=(change_fev1pp = Change));
class finalgold_P1 (ref='GOLD 0') diabetes_p1 (ref="No");
model Change = finalgold_P1 diabetes_p1 finalgold_p1*diabetes_p1;
lsmeans diabetes_p1 finalgold_P1/ pdiff;
format finalgold_p1 Baseline_GOLD_Stage. diabetes_p1 diabetes_baseline. diabetes_P3 diabetes_final.;
label Change ='Change in FEV1pp';
run;
Output:
I've tried:
1. Using rename for diabetes_P1. This does not work, I think due to the formatting of diabetes_P1 to diabetes_baseline.
2. I tried adding Title = 'Change in FEV1pp Over 10 Years' into the code. There are no errors, but it doesn't change the title.
Someone suggested I use ODS but I am unfamiliar with using that code. Is there an easy way to incorporate what I need into this code?
... View more
DATA ALT;
SET RCA.CLOSING_STATUS_TEST;
ARRAY COLS[*] _CHARACTER_;
ARRAY COLS_[*] _CHARACTER_;
DO I = 1 TO DIM(COLS);
IF MOD(I, 2) = 1 THEN
COLS_[(I+1)/2] = COLS[I];
END;
DROP I;
RUN;
Hi, I have been trying to select the alternate columns. If I am using this code then my third column's data shifts to second column and second's values are disappearing. I want to select alternate columns from my data set and my column names are in following: LOAN_NO, PRODUCT, FINAL_STATUS_05MAY24,DUE_N_TAG_05MAY24, FINAL_STATUS_06MAY24,DUE_N_TAG_06MAY24, FINAL_STATUS_07MAY24,DUE_N_TAG_07MAY24,... and so on. I want to create a table selecting columns:-
LOAN_NO, FINAL_STATUS_05MAY24, FINAL_STATUS_06MAY24, FINAL_STATUS_07MAY24... and so on. If there is any alternate approach for making the selection, please advise me or please help with the given array code.
... View more
I am working on a Multivariate multilevel model where The 3 outcome variables RCBPre_Rating RCTPre_Rating RCSPre_Rating are continuous but changes in all three need to be considered simultanously as participants can indicate more or less of each RC type and this combination explains what they believe the complex root causes of an Ableism scenario are (RC1 is bias, RC2 is a lack of training, and RC3 is systemic barriers). The data set is double stacked where items (vignettes) are nested within Participants. There are item-level variables of ableism type (AT, 4 categories) (OB, 4 levels), and 2 item-level covariates of Trial oder. There are participant-level variables of teacher type (TT, 3 categories), and years of experience (YOE), and the participant-level covariates such as other demographic variables ( INLevel INDisSchool INLOE PerDis FamDis EthnicitySel Race Gender Ableismselfassess). I have tried two different ways to get the model to run, one using mutilple model lines in the proc mixed statement, and one using one model line with all three outcome variables, neither way is working! please help me! Syntax for each way is shown below. First way: proc mixed data=RQ2 method=ml; class ResponseID Vignette AT OB Teachertype INLevel INdisschool INLOE PerDis FamDis EthnicitySel Race Gender ADCTO Vtrialorder; /* Model statement for RC1 */ model RCBPre_Rating = OB|AT Teachertype|YOE Teachertype|YOE INLevel INDisSchool INLOE PerDis FamDis EthnicitySel Race Gender Ableismselfassess ADCTO Vtrialorder / solution ddfm=bw; /* Model statement for RC2 */ model RCTPre_Rating = OB|AT Teachertype|YOE Teachertype|YOE INLevel INDisSchool INLOE PerDis FamDis EthnicitySel Race Gender Ableismselfassess ADCTO Vtrialorder / solution ddfm=bw; /* Model statement for RC3 */ model RCSPre_Rating = OB|AT Teachertype|YOE Teachertype|YOE INLevel INDisSchool INLOE PerDis FamDis EthnicitySel Race Gender Ableismselfassess ADCTO Vtrialorder / solution ddfm=bw; /* Random effects */ random intercept / subject=ResponseID type=un; /* Random intercept for participants */ random intercept / subject=vignette type=un; /* Random intercept for vignettes */ /* Random slopes for participant-level effects */ random ADCTO / subject=vignette; Vtrialorder / subject=vignette; random OB / subject=vignette; random AT / subject=vignette; /* Allow covariance structure to account for multivariate response */ repeated / subject=ResponseID*vignette type=un group=ResponseID; run; Second way: proc mixed data=RQ2 covtest NOCLPRINT Method=REML; class ResponseID Vignette AT OB Teachertype INLevel INdisschool INLOE PerDis FamDis EthnicitySel Race Gender ADCTO Vtrialorder; /* Model statement for RC1 */ model RCBPre_Rating RCTPre_Rating RCSPre_Rating = OB|AT Teachertype|YOE Teachertype|YOE INLevel INDisSchool INLOE PerDis FamDis EthnicitySel Race Gender Ableismselfassess ADCTO Vtrialorder / solution DDFM=Satterthwaite; /* Random effects */ random intercept / subject=ResponseID type=un; /* Random intercept for participants */ random intercept / subject=Vignette type=un; /* Random intercept for vignettes */ /* Random slopes for participant-level effects */ random ADCTO / subject=ResponseID; random Vtrialorder / subject=ResponseID; random OB / subject=Vignette; random AT / subject=Vignette; /* Allow covariance structure to account for multivariate response */ repeated / subject=ResponseID*vignette type=un group=ResponseID; parms / ols; run;
... View more