I need to add a horizontal reference line at 90% to represent my target in the p-chart. When I put href=0.9 in my code I got the following warning "WARNING: Numeric href= values are incompatible with a character subgroup variable; HREF= lines are not displayed." The warning indicates that the href value is not compatible because the subgroup variable, quarter, is treated as a character data type. How to include the target line? Here is my code: proc shewhart data=tmp2; pchart yes_answer1*quarter/ markers subgroupn = total_count1 nohlabel Href=0.9; run;
... View more
with the following code, the chart displays a label " p-chart for yes_answer1" at the top, under the main chart title. I have two questions about that: How to remove that, i.e "p-chart for yes_answer1" ? How can I modify the chart so that the main title " P-chart of Patient Counseling by Quarter" appears at the top of the chart instead of "p-chart for yes_answer1" title "P-chart of Patient Counseling by Quarter"; proc shewhart data=tmp2; pchart yes_answer1*quarter/ markers subgroupn = total_count1 nohlabel ; LABEL yes_answer1 ="Proportion of pts counselled"; /*this would be for y axis and no issue with this*/ run; title;
... View more
Dear Community, I am a new SAS Studio user (9.4) and am struggling with the following task. I need to merge two files. One is located in SAS WRDS Cloud (let's name it File 1), and another one is located on my local drive (let's name it File 2). File 1 is approximately 300 GB, so all manipulations must be performed in the Cloud, and then the final version of the merged file would be stored locally. I need to merge File 1 and File 2 based on CompanyID and Year. When I try to sort File 1 by CompanyId and Year prior to merging, the system rightfully says that I do not have permission to manipulate that file (as it is a WRDS raw data file, the message is "ERROR: User does not have appropriate authorization level for library RBDX). However, I cannot download the file locally as it is too large. What is the best way to merge the two files, and what would be the appropriate code? Many thanks for any help! Best, Ana.
... View more
Hi all, This one is quite frustrating. I want to return the Nth word of a string which matches (NOT case-sensitive) my 'search term'. Illustrated with example code using sashelp dataset. My code : *Create string which will be searched;
%let allowedTeams=montreal Cleveland ATLANTA houston Pittsburgh;
*Test dataset;
data work.baseballTest (drop=allowedT);
set sashelp.baseball(keep=team );
if _n_ < 20;
allowedT='montreal Cleveland ATLANTA houston Pittsburgh';
*Various styles of findw None of which appear to work;
findwRes1 = findw("&allowedTeams",team,' ','ei');
findwRes2= findw(allowedT,team,' ','e i');
findwRes3= findw("montreal Cleveland ATLANTA houston Pittsburgh",team,' ','e i');
findwRes4= findw(upcase("&allowedTeams"),upcase(team),' ','E');
findwRes5= findw("&allowedTeams",team,' ','i');
findwRes6= findw("&allowedTeams",team);
*Indexw locates the string. But extra work is needed to get the ;
*number of the word in the string;
indexwRes= indexw(upcase("&allowedTeams"), upcase(team));
if indexwres > 0 then do;
indexwRes1= countw(substr("&allowedTeams", 1, indexwRes), ' ', 'i');
end;
run; On running this code I attempt several different ways to get the FINDW to work for me (findwRres1-6) . Looking in the resultant dataset none of them do as they are all =0. I am able to use a workaround using indexw and countw (as shown) which does work correctly but is not as slick as the FINDW solution would be. Can anyone suggest what is going wrong with my findw attempts?
... View more
Hi guys,
suppose to have the following:
data DB1;
input ID Discharge;
format Discharge date9.;
cards;
0001 19JUN2017
0001 07SEP2020
0002 17MAR2016
0003 05MAY2016
0003 08FEB2017
0004 22MAR2017
0004 03MAY2017
0004 28MAR2021
;
data DB2;
input ID Discharge Flag NewDate;
format Discharge NewDate date9.;
cards;
0001 19JUN2017 0 .
0001 07SEP2020 1 08SEP2020
0002 17MAR2016 1 18MAR2016
0003 05MAY2016 0 .
0003 08FEB2017 1 09FEB2017
0004 22MAR2017 0 .
0004 03MAY2017 0 .
0004 28MAR2021 1 29MAR2021
;
Is there a way to add a flag to DB1 where for each ID there's the latest date (if there is only one date as for ID 0002 the last date will be the one reported) and then add the new date corresponding to the last + 1 day? Desired output: DB2.
Thank you in advance
... View more