sas_epi Tracker
https://communities.sas.com/kntur85557/tracker
sas_epi TrackerSun, 21 Jul 2024 04:21:11 GMT2024-07-21T04:21:11ZRe: Using proc report to combine graphs
https://communities.sas.com/t5/SAS-Programming/Using-proc-report-to-combine-graphs/m-p/604640#M175310
Hi ChrisNZ,<BR />Thanks for the suggestion. I had unsuccessfully attempted both the options in that link before I posted on the forum. Unison's code helped me out!Fri, 15 Nov 2019 21:36:25 GMThttps://communities.sas.com/t5/SAS-Programming/Using-proc-report-to-combine-graphs/m-p/604640#M175310sas_epi2019-11-15T21:36:25ZRe: Using proc report to combine graphs
https://communities.sas.com/t5/SAS-Programming/Using-proc-report-to-combine-graphs/m-p/604488#M175263
<P>The log file output is right below that code itself- it told me that width of column 1 needs to be between 1 and 97. I re ran the same code with length set to 97 and the error message changed to below. I'm copying and pasting directly from the log file ::</P><P> </P><P>*********************************************************************************************************************************</P><P>NOTE: Argument 2 to function CATS('^S={width=8.'[12 of 38 characters shown],'C:\Users\lm3'[12 of 66 characters shown],'\srsthirdt3.'[12 of 17 characters shown]) at line 194 column 9 is invalid.</P><P><BR />WARNING: In a call to the CATS function, the buffer allocated for the result was not long enough<BR />to contain the concatenation of all the arguments. The correct result would contain 121<BR />characters, but the actual result might either be truncated to 97 character(s) or be<BR />completely blank, depending on the calling environment. The following note indicates<BR />the left-most argument that caused truncation.<BR />NOTE: Argument 2 to function CATS('^S={width=8.'[12 of 38 characters shown],'C:\Users\lm3'[12 of<BR />66 characters shown],'\srsthirdt4.'[12 of 17 characters shown]) at line 195 column 9 is<BR />invalid.<BR />c1= c2= _ERROR_=1 _N_=1</P><P> </P><P>**********************************************************************************************************************</P><P> </P><P>When I have the length specified as 150, the link to the location of the graphs gets pasted on the columns of the 'combine' data set, and when I change the length to 97, that disappears -possibly coz the column is now too small . One of the first things I checked was to see if the graphs were being created and stored in the location that I specified, that part works.</P>Fri, 15 Nov 2019 14:56:35 GMThttps://communities.sas.com/t5/SAS-Programming/Using-proc-report-to-combine-graphs/m-p/604488#M175263sas_epi2019-11-15T14:56:35ZRe: Using proc report to combine graphs
https://communities.sas.com/t5/SAS-Programming/Using-proc-report-to-combine-graphs/m-p/604471#M175260
<P>So sorry about that Unison ! I didn't know that I could post the code that way, Thanks !</P><P> </P><P>I had commented out the 'proc report' that I wasn't using</P>Fri, 15 Nov 2019 14:28:30 GMThttps://communities.sas.com/t5/SAS-Programming/Using-proc-report-to-combine-graphs/m-p/604471#M175260sas_epi2019-11-15T14:28:30ZRe: Using proc report to combine graphs
https://communities.sas.com/t5/SAS-Programming/Using-proc-report-to-combine-graphs/m-p/604455#M175256
<P>I kept the 'back slash' as is in the code, I figured that it'd be a windows necessity. Tried removing the wrapper in the macro variable definition, no change in the errors.</P><P>When you create the 'combine' data set, what do you see in the file? I see the link to the location of the graph pasted on the columns. It seems to me that when I create the dataset, SAS wants me to have enough length for the column, but when I call 'proc report' it doesn't like that length and wants me to change it to a max of 97. So, 'proc report' is not able to take the link information and use it to get the .png file, maybe?</P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P><P> </P>Fri, 15 Nov 2019 13:39:03 GMThttps://communities.sas.com/t5/SAS-Programming/Using-proc-report-to-combine-graphs/m-p/604455#M175256sas_epi2019-11-15T13:39:03ZRe: Using proc report to combine graphs
https://communities.sas.com/t5/SAS-Programming/Using-proc-report-to-combine-graphs/m-p/604435#M175246
<P>Hello Unison,</P><P> </P><P>Thank you for your comments and code. It didn't work out quite as expected though. The code that I used is below. As you can see, when I used a column length of 150, I get the error that the length needs to be between 1 and 97</P><P> </P><PRE><CODE class=" language-sas">data combine;
length c1 c2 $150;
c1= cats('^S={width=8.5cm just=center preimage="', "&png_dest", '\srsthirdt1.png"}');
c2= cats('^S={width=8.5cm just=center preimage="', "&png_dest", '\srsthirdt2.png"}');
output;
c1= cats('^S={width=8.5cm just=center preimage="', "&png_dest", '\srsthirdt3.png"}');
c2= cats('^S={width=8.5cm just=center preimage="', "&png_dest", '\srsthirdt4.png"}');
output;
run;
ods escapechar='^';
proc report data=combine nowindows style=[rules=none frame=void cellpadding=0] list;
columns c1 c2;
define c1-c2 /display ' ';
run;</CODE></PRE><P>**This is from the log file:</P><P> </P><P>PROC REPORT DATA=WORK.COMBINE LS=97 PS=54 SPLIT="/" CENTER ;<BR />COLUMN ( c1 c2 );</P><P>DEFINE c1 / DISPLAY FORMAT= $150. WIDTH=150 SPACING=2 LEFT " " ;<BR />DEFINE c2 / DISPLAY FORMAT= $150. WIDTH=150 SPACING=2 LEFT " " ;<BR />RUN;</P><P>ERROR: The width of c1 is not between 1 and 97. Adjust the column width or line size.<BR />NOTE: This affects LISTING output.</P><P> </P><P>So, I try changing the length to 97 and get a different error with 'cats' function. Please see below:</P><P> </P><P> </P><P>WARNING: In a call to the CATS function, the buffer allocated for the result was not long enough to contain the concatenation of all the arguments. The correct result would contain 123 characters, but the actual result might either be truncated to 97 character(s) or be<BR />completely blank, depending on the calling environment. The following note indicates the left-most argument that caused truncation.<BR />NOTE: Argument 2 to function CATS('^S={width=8.'[12 of 38 characters shown],'''C:\Users\lm'[12 of 68 characters shown],'\srsthirdt1.'[12 of 17 characters shown]) at line 143 column 9 is invalid.</P><P> </P><P> </P><P>Do you think it is due to the location I'm saving the graphs at?</P><P> </P><P>Thanks!</P><P> </P><P> </P>Fri, 15 Nov 2019 14:24:05 GMThttps://communities.sas.com/t5/SAS-Programming/Using-proc-report-to-combine-graphs/m-p/604435#M175246sas_epi2019-11-15T14:24:05ZUsing proc report to combine graphs
https://communities.sas.com/t5/SAS-Programming/Using-proc-report-to-combine-graphs/m-p/603913#M175009
<P>Hello All,</P><P> </P><P>I'm trying to create a panel of graphs created using 'proc plm'. I'm basing this on the PhUSE 2017 paper on 'combining ODS graphics output' by John Hendrickx. The outline of the code is below:</P><P> </P><P>*********************************************************************************************;</P><P>ods _all_ close;<BR />ods listing gpath="&png_dest" style=Pearl dpi=300;</P><P>ods graphics on /reset=index width=8.5cm outputfmt=png imagename='srsthirdt1';</P><P> </P><P>proc plm ....<BR />run;</P><P> </P><P>ods graphics on /reset=index imagename='srsthirdt2';</P><P> </P><P>proc plm ...<BR />run;</P><P><BR />ods graphics on /reset=index imagename='srsthirdt3';</P><P><BR />proc plm ...<BR />run;</P><P>ods graphics on /reset=index imagename='srsthirdt4';</P><P><BR />proc plm ...<BR />run;</P><P><BR />data combine;<BR />length c1 c2 $200;<BR />c1= '^S={width=8.5cm just=center preimage="&png_dest\srsthirdt1.png"}';<BR />c2= '^S={width=8.5cm just=center preimage="&png_dest\srsthirdt2.png"}';<BR />output;<BR />c1= '^S={width=8.5cm just=center preimage="&png_dest\srsthirdt3.png"}';<BR />c2= '^S={width=8.5cm just=center preimage="&png_dest\srsthirdt4.png"}';<BR />output;<BR />run;</P><P><BR />proc report data=combine nowindows style=[rules=none frame=void cellpadding=0] list;<BR />columns c1 c2;<BR />define c1-c2 /display ' ';<BR />run;</P><P>*********************************************************************************************;</P><P>I can see that the graphs have been created in the location that I specified. When I run 'proc report', it gives me an error that "The width of c1 is not between 1 and 97. Adjust the column width or line size.". On changing the column size to 97 (no specific reason to chose this number other than the error note), the output displays the location of the file: ^S={width=8.5cm just=center preimage="&png_dest\srsthirdt1.png"}, for each of the 4 figures.<BR /><BR /></P><P>I've tried closing the ods listing as suggested in a few posts. I had an intuition that it wouldn't work in my case, but figured I'd try it anyway- Of course, it didn't. The other suggested option was to reduce the linesize, which led the location of the file to be displayed instead of the figures. I don't use proc report much and admit that I don't know all that the keywords are doing in the code!</P><P> </P><P>Any suggestions are much appreciated.</P><P> </P><P>Thanks!</P><P> </P><P> </P><P> </P>Wed, 13 Nov 2019 17:42:01 GMThttps://communities.sas.com/t5/SAS-Programming/Using-proc-report-to-combine-graphs/m-p/603913#M175009sas_epi2019-11-13T17:42:01ZRe: Values of x-variable used in effectplot
https://communities.sas.com/t5/Statistical-Procedures/Values-of-x-variable-used-in-effectplot/m-p/590724#M28894
<P>Thank you Rick, that makes sense to me.</P>Sun, 22 Sep 2019 11:53:12 GMThttps://communities.sas.com/t5/Statistical-Procedures/Values-of-x-variable-used-in-effectplot/m-p/590724#M28894sas_epi2019-09-22T11:53:12ZRe: Values of x-variable used in effectplot
https://communities.sas.com/t5/Statistical-Procedures/Values-of-x-variable-used-in-effectplot/m-p/590223#M28855
<P>Thank you for comment, ballardw. The code is below. This works- I get the plot that I want. My confusion is on the difference in the N that the glm model is running (N=90) and the N for the data that plm outputs (n=200)</P><P> </P><P><BR />proc glm data=finaldata plots=(diagnostics residuals(smooth));<BR />class year (ref="2011") gender(ref="F") site(ref="DU") bmi_cat (ref="Normal") matrace (ref="NH White") education (ref="Bachelors or higher") income (ref="100- <200 K") parity(ref="1");<BR />model totscore= ph1 site bmi_cat matrace education income matage gender year parity/solution CLPARM;<BR />store ph1pred;<BR />run;<BR />quit;</P><P> </P><P>proc plm restore= ph1pred;<BR />effectplot fit(x= ph1) / at(gender="F") at(site="DU") at(matrace="NH White") at(bmi_cat="Normal") at(education="Bachelors or higher") at(income="100- <200 K") at(parity="1") at(year="2011");<BR />ods output FitPlot= ph1pred;<BR />run;</P><P><BR />data ph1pred;<BR />set ph1pred (keep= _XCONT1 _PREDICTED);<BR />rename _XCONT1= ph1;<BR />rename _PREDICTED= totscore;<BR />run;</P><P> </P><P>....... running the same model 14 times with different 'ph' variables and producing output data, I merged them to get a data set with all predicted data. Then plot as below:</P><P> </P><P><BR />proc sgplot data= finalpred;<BR />series x=ph1 y=totscore1 ;<BR />.</P><P>.</P><P>.<BR />series x=ph14 y=totscore14;</P><P> </P><P>yaxis grid values=(1.5 to 4.5 by .5);<BR />xaxis label="ph";<BR />yaxis label="Predicted score";<BR />title "Predicted plot of ph1-p14";<BR />run;</P><P> </P><P> </P><P> </P>Thu, 19 Sep 2019 22:02:16 GMThttps://communities.sas.com/t5/Statistical-Procedures/Values-of-x-variable-used-in-effectplot/m-p/590223#M28855sas_epi2019-09-19T22:02:16ZValues of x-variable used in effectplot
https://communities.sas.com/t5/Statistical-Procedures/Values-of-x-variable-used-in-effectplot/m-p/590101#M28850
<P>Hello..</P><P> </P><P>I'm running multiple multivariable linear regression models (same set of covariates, changing primary predictor) using proc glm and then using the effectplot command in proc plm to plot the models. I would like to also have a single plot with all models overlaid on it. After reading through posts here, I figured that the best option for me was to output the predicted data from within the proc plm command , merge all of them and then try to plot them using sgplot. I'm running my glm on an N of 90 and have 10 variables in the model- 2 are continuous, the rest are categorical. There are no missing data in this file.</P><P>Things were moving reasonably well till I looked at the data output from the plm command. The data output from proc plm 'FitPlot' has an N of 200. I recognize the first and last values of my primary predictor X variable. Based on some of the posts here, I think that the procedure is somehow taking a set of values from the X-variable and using them in the model to predict the outcome- Is this the case? If so, does this somehow dictate the increase in N from the original data?</P><P>I feel like I understand why the actual x values are not used (but would like to confirm this)- the resulting prediction would a be a 'jittered' scatter of points and would produce a jagged line. Is this so?</P><P> </P><P>Thank you!</P><P> </P>Thu, 19 Sep 2019 16:24:38 GMThttps://communities.sas.com/t5/Statistical-Procedures/Values-of-x-variable-used-in-effectplot/m-p/590101#M28850sas_epi2019-09-19T16:24:38Z