Creating an AI Assistant for SAS Viya in 5 steps (@sassoftware/viya-assistantjs) - Part I
Recent Library Articles
Recently in the SAS Community Library: SAS' @kumardeva debunks the myth that developing AI assistants is too hard. He shows you how to use the @sassoftware/viya-assistantjs library to jump start your development.
Hi, I have 2 data sets like below. Data one A 1 A 2 B 1 B 2 Data two A Apple A Peach B Banana I need to join them (Cartesian join), but only join by ID (A and B). This is what I want to get: A 1 Apple A 1 Peach A 2 Apple A 2 Peach B 1 Banana B 2 Banana If I use the below code, proc sql; create table three as select one.* ,two.* from one ,two; quit; What I have got was A 1 Apple A 1 Peach A 1 Banana A 2 Apple A 2 Peach A 2 Banana B 1 Apple B 1 Peach B 1 Banana B 2 Apple B 2 Peach B 2 Banana Is there any way to only join by the ID (A, B)? Thank you very much!
... View more
Howdy!
If I specify a font size in SGPLOT, SAS does not seem to actually produce that font size in ODS PDF. It seems to produce some larger font size. Here's example code.
ods pdf file = "M:\test.pdf";
ods graphics on / reset;
title1 height = 12pt font = 'Arial' 'Title 1';
title2 height = 11pt font = 'Arial' 'Title 2';
title3 height = 10pt font = 'Arial' bold 'Title 3';
footnote1 height = 9pt font = 'Arial' 'Footnote 1';
footnote3 height = 8pt font = 'Arial' 'Footnote 2';
proc sgplot data = sasHelp.class; series x = name y = age; xAxis valueAttrs = (family = 'Arial' size = 9.5pt); run;
proc sgplot data = sasHelp.class; series x = name y = age; xAxis valueAttrs = (family = 'Arial' size = 10pt); run;
proc sgplot data = sasHelp.class; series x = name y = age; xAxis valueAttrs = (family = 'Arial' size = 10.5pt); run;
proc sgplot data = sasHelp.class; series x = name y = age; xAxis valueAttrs = (family = 'Arial' size = 11pt); run;
proc sgplot data = sasHelp.class; series x = name y = age; xAxis valueAttrs = (family = 'Arial' size = 11.5pt); run;
proc sgplot data = sasHelp.class; series x = name y = age; xAxis valueAttrs = (family = 'Arial' size = 12pt); run;
ods pdf close;
Title1 comes out as 13 pt. Title2 as 11.5 pt.
Title3 as 11 pt.
Footnote1 as 9.5 pt.
Footnote2 as 9 pt.
The x-axis tick values come out as 9.5, 11, 11, 11.5, 11.5, and 13 pt. respectively.
If I add noGTitle and noGFootnote to the ODS PDF statement, then the font sizes for the titles and footnotes are correct. It seems the problem is with the graphic procedure itself.
I checked the font sizes by copying the text from the PDF and pasting into Word. I am fairly certain the same happens with ODS RTF; I can't paste the text into Word, but eyeballing it, it looks the same. Attached are the PDF and RTF outputs each way, plus a screenshot of the side-by-side comparison of the two RTF files showing that the font without noGTitle definitely is bigger than the font with noGTitle.
Does anyone else also get this? I tested on a SAS session with no other options, custom configuations, etc. but maybe there's still something set on my machine that is messing it up.
Best regards,
Michael
... View more
Hi all - I have a specific report format that I am trying to achieve using PROC REPORT, and I'm getting pretty close, but there's a column subtotal element that I cannot figure out.
I have sales data, summarized by Client, Quarter, and Week. Each quarter contains an arbitrary number of weeks, up to around 13.
I would like to list Client information down the side, with:
Quarters listed across the top,
each Quarter's corresponding Weeks nested underneath,
the table populated with Sales for each Client-Week,
and Grand Totals on the far right and bottom. I've gotten this far on my own just fine.
Where I'm getting stuck is that I'd also like to show Quarterly subtotal columns, at the end of each Quarter. I have tried different variations of "break after" and the like, but I'm just not getting there.
Does anyone in the community have any suggestions? Below is some sample code that represents the progress I've made so far. I've also attached an image showing what I currently "have" versus what I "want." I greatly appreciate any and all help - cheers!
data one; input client_rank client $9. client_id quarter $ weekending sales; datalines; 1 Apple 12345 Q1 20240106 1000 1 Apple 12345 Q1 20240113 2000 1 Apple 12345 Q1 20240127 5000 1 Apple 12345 Q2 20240413 3000 1 Apple 12345 Q2 20240420 4000 1 Apple 12345 Q2 20240427 2000 2 Microsoft 67890 Q1 20240106 3000 2 Microsoft 67890 Q1 20240113 1000 2 Microsoft 67890 Q1 20240127 2500 2 Microsoft 67890 Q2 20240413 4000 2 Microsoft 67890 Q2 20240420 500 2 Microsoft 67890 Q2 20240427 1500 ; run;
proc report data = one nowd; column client_rank client client_id quarter, weekending, sales ("Total" sales=tot); define client_rank / noprint group; define client / "Client" group; define client_id / "Client ID" group; define quarter / " " across; define weekending / " " across nozero; define sales / "Sales" analysis sum format=comma12.0; define tot / "Sales" analysis sum format=comma12.0;
rbreak after / summarize; compute after; client = "Total"; endcomp; define client_rank / order group; run;
... View more
Hi, I am currently working on a report which I want to refresh each month with the latest data - I have a date parameters representing the current month, but my question is if there anyway I can increment it using the calculated items to create multiple date parameters as I want to specify the periods for which my data is from and I can't see any other feasible way of doing this? Thanks
... View more
Hi, I'm trying to create a table like this: From this output: I only want to keep the values where both variable have a value of 1. The above output was created using the following code: Proc surveyfreq data=work.ocd;
table dsm_OCD*(Contamination_OC Harming_OC Ordering_OC Hoarding_OC Sex_rel_mor_OC Any_OC One_OC Two_OC Three_OC Four_OC Five_OC)/nowt;
weight finalp2wt;
run;
... View more