The LITI rule for Text Analytics that you didn’t know you needed…until now!
Recent Library Articles
Recently in the SAS Community Library: Customer complaint call transcripts can end up being quite verbose. SAS' @PeterChristie reveals how to distill relevant info using SAS Text Analytics.
Hi all, SAS amateur here! I am trying to figure out how to create 2 new variables and assign values to each observation based on the data contained in a reference file. I have created a mock example below. The first dataset is the main one I need to keep. It contains data on individual stores and several stores will have the same corporate ID. The second dataset is a reference that contains approximately 500 Corporate IDs and addresses, including the State and City. I would like to create 2 new variables for CorpState and CorpCity in Dataset 1 based on the CorpID contained in both files. Is this even possible to do and where do I start? Any help would be greatly appreciated. Dataset 1 (Have): Main dataset with individual store information Obs# CorpID StoreID StoreState 1 4002 40021234 AL 2 4002 40021237 MS 3 4003 40035678 TN 4 4100 41007890 WV 5 4110 41103456 NC 6 4110 41103478 NC 7 4597 45972345 WA 8 4975 49750023 WY Dataset 2 (Have): Reference dataset with corporate information Obs# CorpID CorpState CorpCity 1 4002 AL Birmingham 2 4003 GA Atlanta 3 4004 TN Nashville 4 4100 SC Charleston 5 4110 NC Charlotte 6 4111 FL Tampa 7 4597 CA San Francisco 8 4975 WY Jackson Want: Dataset 1 file containing store and corporate information Obs# CorpID CorpState CorpCity StoreID StoreState 1 4002 AL Birmingham 40021234 AL 2 4002 AL Birmingham 40021237 MS 3 4003 GA Atlanta 40035678 TN 4 4100 SC Charleston 41007890 WV 5 4110 NC Charlotte 41103456 NC 6 4110 NC Charlotte 41103478 NC 7 4597 CA San Francisco 45972345 WA 8 4975 WY Jackson 49750023 WY
... View more
Hello, I am trying to do seamless export of data from a database to SAS. I am trying to follow the Redcap model of downloading three files: SAS file, Pathway mapper and CSV file. Does anyone in the community know how to go about implementing this? Sorry, if I am asking this question in the wrong discussion community. If I am, please direct me to the right group. Thank you! Ken
... View more
data test; input id fname $4. lname $5. age; cards; 123 abc1 def1 24 124 abc2 def2 25 125 abc3 def3 26 ; run; in proc report how to get output below based upon condition ?
if id = 123 then display only fname and lname
fname lname abc1 def1 abc2 def2 abc3 def3
if id = 124 then display only fname
fname abc1 abc2 abc3
if id = 125 then display only age
age 24 25 26
... View more
data test; input id fname $4. lname $5. age; cards; 123 abc1 def1 24 124 abc2 def2 25 125 abc3 def3 26 ; run;
data test2; input id state $7. county $9. ; cards; 123 state1 county1 124 state2 county2 125 state3 county3 ; run;
options orientation=landscape; ods pdf file="location\name.pdf"; Title1 "Test"; ods proclabel='';
proc report data=test contents='' headline nowindows ;by id ; columns id fname lname age; run;
proc report data=test2 contents='' headline nowindows ;by id ; columns id state county; run;
ods pdf close;
Iam looking only one table of contnets for both tables on left side ? is there any i can do and get the ouput ?
... View more
Hi everyone. I'm trying to add an at-risk table to my Kaplan-Meier curves. I'm using the survival macros code found here. If I do not use the "outside" option, everything aligns nicely. * Bring in macro;
%ProvideSurvivalMacros
%let tatters = textattrs=(size=14pt);
%let TitleText0 = "3-Year Post-Recurrence Survival" / textattrs=(size=14pt);
%let TitleText1 = &titletext0 ;
%let TitleText2 = &titletext0 ;
%let yoptions = label='Overall Survival Probability' labelattrs=(size=12pt) linearopts=(viewmin=0 viewmax=1
tickvaluelist=(0 .2 0.4 0.6 0.8 1));
%let xoptions = label='Months from Recurrence' labelattrs=(size=12pt) linearopts=(viewmin=0 viewmax=24
tickvaluelist=(0 6 12 18 24));;
%let StepOpts = lineattrs=(thickness=1);
%let LegendOpts = title=' ' location=inside across=1 autoalign=(TopRight) border=FALSE;
%let GraphOpts = attrpriority=none
DataLinePatterns=(Solid);
* 24-Apr-2024: Add number at risk;
%let AtRiskOpts = valueattrs=(size=10pt) ;
%CompileSurvivalTemplates;
ods select survivalplot;
proc lifetest data=post plots=survival(atrisk(maxlen=20 /*outside*/)=0 to 24 by 6);
format group $recur_two.;
time PRS3YrMonths*death3yr(0);
strata group;
run;
ods select all; However, if I request it to be outside the plot area, it is no longer aligned. * Bring in macro;
%ProvideSurvivalMacros
%let tatters = textattrs=(size=14pt);
%let TitleText0 = "3-Year Post-Recurrence Survival" / textattrs=(size=14pt);
%let TitleText1 = &titletext0 ;
%let TitleText2 = &titletext0 ;
%let yoptions = label='Overall Survival Probability' labelattrs=(size=12pt) linearopts=(viewmin=0 viewmax=1
tickvaluelist=(0 .2 0.4 0.6 0.8 1));
%let xoptions = label='Months from Recurrence' labelattrs=(size=12pt) linearopts=(viewmin=0 viewmax=24
tickvaluelist=(0 6 12 18 24));;
%let StepOpts = lineattrs=(thickness=1);
%let LegendOpts = title=' ' location=inside across=1 autoalign=(TopRight) border=FALSE;
%let GraphOpts = attrpriority=none
DataLinePatterns=(Solid);
* 24-Apr-2024: Add number at risk;
%let AtRiskOpts = valueattrs=(size=10pt) ;
%CompileSurvivalTemplates;
ods select survivalplot;
proc lifetest data=post plots=survival(atrisk(maxlen=20 outside)=0 to 24 by 6);
format group $recur_two.;
time PRS3YrMonths*death3yr(0);
strata group;
run;
ods select all; In the macro code, while messing around with the AtRiskLattice sections to try and fix it, I removed "xaxisopts=(display=none)." This did not fix it, but did illuminate the issue a bit. Apparently the axis for the at-risk table is not the same as the overall x-axis: Does anyone have any idea how to get these to align? Please let me know if I can provide more info.
... View more