<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Proc gplot output shows twice in output in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403773#M98131</link>
    <description>&lt;P&gt;Removed the by statement as it is not relevant now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But still graph is getting duplicated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, where exactly you mean to move the ods pdf line&amp;nbsp; as per the given code above?&lt;/P&gt;</description>
    <pubDate>Fri, 13 Oct 2017 02:51:38 GMT</pubDate>
    <dc:creator>krisraa</dc:creator>
    <dc:date>2017-10-13T02:51:38Z</dc:date>
    <item>
      <title>Proc gplot output shows twice in output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403759#M98124</link>
      <description>&lt;P&gt;Below is the code, not sure whats the issue the proc gplot output is showing twice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, another question - how to suppress the directory and dataset contents table in the output pdf file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*raw data path;
libname seretide "C:/xxxx" INENCODING=ASCIIANY; 

*transformed data path;
libname strans "C:/xxxx" INENCODING=ASCIIANY; 

proc datasets library=work nodetails kill;
/* 	modify have/ correctencoding='utf8'; */
quit;

ods listing close;
ods pdf file="C:\Users\User\0001.pdf" startpage=no;

proc sort data=seretide.en out=entable 
	(drop = subjectstatus visit form formentrydate subjectvisitformid);
	 by subjectid;
run;

proc sort data = seretide.dm out=dmtable 
	(drop = subjectstatus visit form formentrydate subjectvisitformid);
	 by subjectid;
run;

proc sort data=seretide.cm out = cmtable 
	(drop = subjectstatus visit form formentrydate subjectvisitformid);
	 by subjectid;
run;

proc sql noprint;
	create table	work.en_dm_cm as
		select		entable.*, dmtable.*, cmtable.*
		from		work.entable (where = (subjectid = '0001'))
		left join	work.dmtable (where = (subjectid = '0001'))
		on			entable.subjectid = dmtable.subjectid
		left join	work.cmtable (where = (subjectid = '0001'))
		on			entable.subjectid = dmtable.subjectid;
quit; 

data patdemo;
	 set	en_dm_cm;
	 where	subjectid = '0001';
	 label	SCRID = 'Screening Number' 
			SUBJINIT = 'Subject Initials'
			BRTHDTC = 'Date of Birth'
			AGE = 'Age (In Years)'
			RACE = 'Race';
	 if _n_ = 1;
run;


proc print data=patdemo noobs label;
Variables SCRID SUBJINIT SUBJID BRTHDTC AGE SEX ETHNIC RACE;
Title 'Patient Information for 0001';
run;

proc sort data=seretide.ae out=aetable;
	by subjectid;
run;
 
data aetab	 (Keep= SUBJECTID AEYN AESEV AESTDAT AEENDAT AEACN AEOUT);
	 	set   work.aetable;
	 	where subjectid = "0001";
	 	Label AEYN      = 'Adverse Event Yes/No'
	 		  AESEV     = 'Adverse Event Severity'
	 		  AESTDAT   = 'Adverse Event Start Date'
	 		  AEENDAT   = 'Adverse Event End Date'
	 		  AEACN     = 'Action Taken'
	 		  AEOUT     = 'Outcome';
run;
	 	
Proc print data=aetab noobs label;
	Title "No Adverse Events Reported for Patient ID: 0001";
run;

data cmtab;
	 set	work.en_dm_cm 
	 		(keep = subjectid CMYN CMTRT CMTRT_PREFERRED CMTRT_DRUGNAME 
	 		 CMINDC CMSTDAT CMENDAT CMDOSTXT CMDOSU CMDOSUSP CMDOSFRQ
	 		 CMFREQSP CMROUTE CMROUTSP );
	 		 
	 where  subjectid = '0001' and CMYN eq ' ';
	 
	 select;
	 		when (CMDOSU = 'Other') CMDOSU = '(mcg)';
	 		when (CMDOSU = 'Milligram') CMDOSU = '(Mg)';
	 		when (CMDOSU = 'Puff') CMDOSU = '(pf)';
	 		Otherwise CMDOSU = '(IU)';
	 end;
	 
	 if CMDOSFRQ = 'Other' then CMDOSFRQ = CMFREQSP;
	 
	 if CMDOSFRQ ne ' '  then 
	 		DDWF = Strip(CMTRT) || ' ' || strip(CMDOSTXT) || ' ' || strip(CMDOSU) || ' '  || '(' || strip(CMDOSFRQ) || ')';
	 else   DDWF = Strip(CMTRT) || ' ' || strip(CMDOSTXT) || strip(CMDOSU);
	 
	 Label	DDWF = 'Drug Dosage with Frequency';
	 
	 Drop	SUBJECTID CMYN CMTRT CMTRT_PREFERRED CMTRT_DRUGNAME CMDOSTXT CMDOSU
	 	 	CMDOSUSP CMDOSFRQ CMFREQSP CMROUTSP;
	 
run;

proc print data=cmtab noobs label;
	Title 'Concomitant Medication history for Patient ID 0001';
run;

proc sort data=seretide.vs out=vstable;
	by subjectid;
run;

data vstab; 
	set vstable (keep =	SUBJECTID VISIT VSPERF VSDAT VSPOS VSTEST VSORRES 
						VSORRESU VSTEST1 VSORRES1 VSORRESU1);
	where subjectid = '0001';
	
	select;
			when (VSORRESU = 'CM') VSORRESU = '(cm)';
			when (VSORRESU = 'Kg') VSORRESU = '(kg)';
			when (VSORRESU = 'Degree Fahrenheit') VSORRESU = '(°F)';
			when (VSORRESU = 'Beats per Minute') VSORRESU = '(bpm)';
			when (VSORRESU = 'Breaths per Minute') VSORRESU = '(brpm)';
			when (VSORRESU = 'mm Hg') VSORRESU = '(mm Hg)';
			when (VSTEST = 'Height') VSORRESU = '(cm)';
			otherwise VSORRESU = ' ';
	end;
	
	select;
			when (VSORRESU1 = 'CM') VSORRESU1 = '(cm)';
			when (VSORRESU1 = 'Kg') VSORRESU1 = '(kg)';
			when (VSORRESU1 = 'Degree Fahrenheit') VSORRESU1 = '(°F)';
			when (VSORRESU1 = 'Beats per Minute') VSORRESU1 = '(bpm)';
			when (VSORRESU1 = 'Breaths per Minute') VSORRESU1 = '(brpm)';
			when (VSORRESU1 = 'mm Hg') VSORRESU1 = '(mm Hg)';
			otherwise VSORRESU1 = ' ';
	end;
	
	if		Visit =	('Randomization (Visit 2/Day 0)') or 
	  		Visit = ('End of Treatment/Early termination (Visit 3)') then do;
	  		VSTEST = VSTEST1;
	  		VSORRES = VSORRES1;
	  		VSORRESU = VSORRESU1;	
	end;
	
	retain _vsdat _vspos;
	
	if not missing(vsdat) then _vsdat = vsdat;
	else vsdat = _vsdat;
	
	if not missing(vspos) then _vspos = vspos;
	else vspos = _vspos;
	
	if vsperf = 'Yes' then delete;
	
	drop _vsdat _vspos VSPERF VSTEST1 VSORRES1 VSORRESU1 ;
run;


Proc sort data=vstab (where=(vstest ne 'Height')) out=vstab;
by vstest vsdat;
run;

data vsdia vssys vstemp vswt vshr vsresp;
	 set vstab;
	 if vstest = 'Diastolic Blood Pressure' then output vsdia;
	 if vstest = 'Systolic Blood Pressure' then output vssys;
	 if vstest = 'Temperature' then output vstemp;
	 if vstest = 'Weight' then output vswt;
	 if vstest = 'Heart Rate' then output vsresp;
run;

Title 'Vital Stats Diastolic Blood Pressure for Patient ID: 0001';

PROC GPLOT DATA = vsdia;
	SYMBOL1 INTERPOL=JOIN HEIGHT=10pt VALUE=NONE LINE=1 WIDTH=2 CV = _STYLE_;
	Axis1 STYLE=1 WIDTH=1 MINOR=NONE label = ('(Hg mm)');
	Axis2 STYLE=1 WIDTH=1 MINOR=NONE;

	PLOT VSORRES * VSDAT  /
 	VAXIS=AXIS1
	HAXIS=AXIS2
	FRAME;
	
	BY VSTEST;
RUN; 

ods pdf close;
ods listing;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Oct 2017 02:26:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403759#M98124</guid>
      <dc:creator>krisraa</dc:creator>
      <dc:date>2017-10-13T02:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Proc gplot output shows twice in output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403765#M98125</link>
      <description>&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;	&lt;SPAN class="token statement"&gt;BY&lt;/SPAN&gt; VSTEST&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will likely cause the multiple plots. Are you sure they're identical?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some suggestions:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Move the ODS PDF right above the reporting section. The data management stuff can be before the ODS PDF statement. It helps to keep things organized.&lt;/LI&gt;
&lt;LI&gt;BY statements should always be right after the PROC statement (after WHERE, if there is one) to help code legibility&lt;/LI&gt;
&lt;LI&gt;Use PROC SGPLOT not GPLOT because it has better quality graphics and is easier to use.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 02:42:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403765#M98125</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-13T02:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc gplot output shows twice in output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403773#M98131</link>
      <description>&lt;P&gt;Removed the by statement as it is not relevant now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But still graph is getting duplicated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, where exactly you mean to move the ods pdf line&amp;nbsp; as per the given code above?&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 02:51:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403773#M98131</guid>
      <dc:creator>krisraa</dc:creator>
      <dc:date>2017-10-13T02:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Proc gplot output shows twice in output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403775#M98133</link>
      <description>&lt;P&gt;Right before the output starts, so in this case it's before PROC GPLOT.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 02:54:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403775#M98133</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-13T02:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc gplot output shows twice in output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403778#M98134</link>
      <description>&lt;P&gt;But I need output from first proc print as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;print&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;patdemo noobs &lt;SPAN class="token function"&gt;label&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Oct 2017 02:57:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403778#M98134</guid>
      <dc:creator>krisraa</dc:creator>
      <dc:date>2017-10-13T02:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc gplot output shows twice in output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403782#M98136</link>
      <description>&lt;P&gt;Can you move the PROC PRINT?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: This is a style issue, you don't need to make the change. I just find it easier to have my code set up in this manner.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 03:45:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403782#M98136</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-13T03:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Proc gplot output shows twice in output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403946#M98175</link>
      <description>Directory and dataset contents: you mean from `PROC DATASETS`?  That's before the `ODS PDF`, so it shouldn't be there...  are you sure you're running exactly what you posted here?&lt;BR /&gt;&lt;BR /&gt;Definitely add `QUIT` to the PROC GPLOT, as it needs it.  Probably won't cause the problem you're seeing, but it could.&lt;BR /&gt;&lt;BR /&gt;Can you write an example using `SASHELP.CLASS` or similar that still causes this problem (so we can run it and see the problem ourselves)?</description>
      <pubDate>Fri, 13 Oct 2017 14:32:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403946#M98175</guid>
      <dc:creator>snoopy369</dc:creator>
      <dc:date>2017-10-13T14:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: Proc gplot output shows twice in output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403954#M98178</link>
      <description>&lt;P&gt;snoopy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Reg. directory and datasets: I meant in the result window 2 tables are displayed on top as attached. I don't want that in the output PDF.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 14:42:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403954#M98178</guid>
      <dc:creator>krisraa</dc:creator>
      <dc:date>2017-10-13T14:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: Proc gplot output shows twice in output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403967#M98184</link>
      <description>&lt;P&gt;Krisraa, that is indeed the PROC DATASETS output.&lt;/P&gt;
&lt;P&gt;What that means to me is that you are somehow running this twice without closing ODS PDF. I.e., something like this is actually happening:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets ... ;
quit;
ods pdf file="whatever.pdf";
proc gplot ... ;
run;
...
proc datasets ...;
quit;
ods pdf file="whatever.pdf";
proc gplot ... ;
run;

ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'm sure that's not what you intended.&amp;nbsp; The ODS PDF CLOSE; is not happening&amp;nbsp;after the first run, for whatever reason.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 14:54:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/403967#M98184</guid>
      <dc:creator>snoopy369</dc:creator>
      <dc:date>2017-10-13T14:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc gplot output shows twice in output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/404059#M98221</link>
      <description>&lt;P&gt;Running this in EG? Or SAS Studio?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add QUIT; after the RUN; in the PROC GPLOT block.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;RUN;&lt;/STRONG&gt; is required to run it.&amp;nbsp; Another RUN; before a QUIT will run it again...&amp;nbsp; And EG/SAS Studio automatically add a RUN/QUIT 1-2 punch to close out open-ended statements.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 18:11:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/404059#M98221</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-10-13T18:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: Proc gplot output shows twice in output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/404075#M98226</link>
      <description>&lt;P&gt;Chris,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks! yes adding quit; resolved it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using SAS Studio 3.5&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 19:05:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-gplot-output-shows-twice-in-output/m-p/404075#M98226</guid>
      <dc:creator>krisraa</dc:creator>
      <dc:date>2017-10-13T19:05:19Z</dc:date>
    </item>
  </channel>
</rss>

