<?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: Categorical Data on X Axis in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737005#M21439</link>
    <description>Hello! I actually figured it out! I had to change my data set name! Thank you for all the help, once I changed the named of my data set I was able to use the proc format</description>
    <pubDate>Mon, 26 Apr 2021 14:52:55 GMT</pubDate>
    <dc:creator>RaquelAR</dc:creator>
    <dc:date>2021-04-26T14:52:55Z</dc:date>
    <item>
      <title>Categorical Data on X Axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/736634#M21418</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am analyzing data of different strains with different genotypes and I am trying to format the x axis a certain way. My data is categorical and I would prefer not to change it numbers. I added a xaxis values statement and now my graph looks crazy. Any suggestions? I attached photos of before I used the xaxis value statement and after. &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-04-23 at 1.32.59 PM.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58632i2DE1C874411059E4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-04-23 at 1.32.59 PM.png" alt="Screen Shot 2021-04-23 at 1.32.59 PM.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-04-23 at 1.32.45 PM.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58633iA7753F6EE79AAA9B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-04-23 at 1.32.45 PM.png" alt="Screen Shot 2021-04-23 at 1.32.45 PM.png" /&gt;&lt;/span&gt;This is my code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*Creating figure plotting estiamted probs &amp;amp; CI**;&lt;/P&gt;&lt;P&gt;proc logistic data=estimated2 alpha=0.2 noprint;&lt;BR /&gt;class mosquitostrain (ref= 'NO') genotype / param=ref;&lt;BR /&gt;model Alive(Event='1')= mosquitostrain genotype;&lt;BR /&gt;/* 1. Use a procedure or DATA step to write Pred, Lower, and Upper limits */&lt;BR /&gt;output out=LogiOut predicted=estprob2 l=lower95 u=upper95;&lt;BR /&gt;run;&lt;BR /&gt;/* 2. Be sure to SORT! */&lt;BR /&gt;proc sort data=LogiOut;&lt;BR /&gt;by mosquitostrain genotype;&lt;BR /&gt;run;&lt;BR /&gt;/* 3. Use a BAND statement. If more that one band, use transparency */&lt;BR /&gt;title "Predicted Probabilities with 95% Confidence Limits";&lt;BR /&gt;title2 "Four Strains";&lt;BR /&gt;proc sgplot data=LogiOut;&lt;BR /&gt;band x=genotype lower=Lower95 upper=upper95 / group=mosquitostrain transparency=0.75;&lt;BR /&gt;series x=genotype y=estprob2 / group=mosquitostrain curvelabel;&lt;BR /&gt;xaxis grid;&lt;BR /&gt;xaxis values= ('WT,WT' 'WT,HET' 'HET,WT' 'HET,HET' 'MUT,WT' 'WT,MUT' 'HET,MUT' 'MUT,HET' 'MUT,MUT');&lt;BR /&gt;yaxis grid label="Predicted Probability of Survival" max=1;&lt;BR /&gt;keylegend "L" / location=inside position=NW title="Genotype" across=1 opaque;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 17:30:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/736634#M21418</guid>
      <dc:creator>RaquelAR</dc:creator>
      <dc:date>2021-04-23T17:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical Data on X Axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/736635#M21419</link>
      <description>&lt;P&gt;In which SAS product are you submitting your code?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 17:49:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/736635#M21419</guid>
      <dc:creator>Madelyn_SAS</dc:creator>
      <dc:date>2021-04-23T17:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical Data on X Axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/736636#M21420</link>
      <description>SAS 9.4</description>
      <pubDate>Fri, 23 Apr 2021 17:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/736636#M21420</guid>
      <dc:creator>RaquelAR</dc:creator>
      <dc:date>2021-04-23T17:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical Data on X Axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/736648#M21421</link>
      <description>&lt;P&gt;Does a line chart make sense here at all?&lt;BR /&gt;How do I interpret the connection between HET/HET and HET/MUT? I would have assumed a forest plot was more appropriate. See examples at the link below&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/tag/forest-plot/" target="_blank"&gt;https://blogs.sas.com/content/tag/forest-plot/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ignoring visualization choice, code your categories as numbers, ordered so that 1 is your first category and 2 is your second etc.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then graph it but apply a label to your X AXIS so that 1 will display as HET/HET and 2 will display as HET/MUT.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use an informat to map the codes to numbers and then a format to map the numbers back to the data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming your data now looks like this, use the code and apply a format instead with the FORMAT statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings/proceedings/sugi30/001-30.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings/proceedings/sugi30/001-30.pdf&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;GenoCode GenoType Probability UCLM LCLM
1 | HET,HET| 0.2| 0.07| 0.8
2 | HET,MUT| 0.2| 0.07| 0.8
3 | HET,WT| 0.2| 0.07| 0.8&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title "Predicted Probabilities with 95% Confidence Limits";
title2 "Four Strains";
proc sgplot data=LogiOut;
band x=genocode lower=Lower95 upper=upper95 / group=mosquitostrain transparency=0.75;
series x=genocode y=estprob2 / group=mosquitostrain curvelabel;
xaxis grid;

format genocode genofmt.;

xaxis values= ('WT,WT' 'WT,HET' 'HET,WT' 'HET,HET' 'MUT,WT' 'WT,MUT' 'HET,MUT' 'MUT,HET' 'MUT,MUT');
yaxis grid label="Predicted Probability of Survival" max=1;
keylegend "L" / location=inside position=NW title="Genotype" across=1 opaque;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 18:45:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/736648#M21421</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-04-23T18:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical Data on X Axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/736661#M21423</link>
      <description>&lt;P&gt;Bands are drawn by creating polygons. This works best when the x coordinate increases monotonically.&amp;nbsp; That is what happens in the original data case, and you get good polygons.&amp;nbsp; When you reorder the x-axis values, the polygons no longer have monotonically increasing x values.&amp;nbsp; So you get self-intersecting polygons.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get non-intersecting polygons, the data set should have the x-values in the same order as the x axis values you want.&amp;nbsp; Or, make the x axis linear (1-9) and use a UDF to label the values&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 20:08:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/736661#M21423</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2021-04-23T20:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical Data on X Axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/736738#M21424</link>
      <description>&lt;P&gt;As Reeza says, a format is the way to go. For an example, see "Method 2" in the article&lt;A href="https://blogs.sas.com/content/iml/2017/04/24/two-way-anova-viz.html" target="_self"&gt; "Visualize an ANOVA with two-way interactions."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Apr 2021 11:17:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/736738#M21424</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-04-24T11:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical Data on X Axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/736888#M21426</link>
      <description />
      <pubDate>Wed, 28 Apr 2021 23:48:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/736888#M21426</guid>
      <dc:creator>RaquelAR</dc:creator>
      <dc:date>2021-04-28T23:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical Data on X Axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/736897#M21427</link>
      <description>Did you remember to change your data so that you have 1 to 5 in the data set? Show your full code, with partial code that refers to data we don't have accessible we can't replicate your issues.</description>
      <pubDate>Mon, 26 Apr 2021 01:56:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/736897#M21427</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-04-26T01:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical Data on X Axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737005#M21439</link>
      <description>Hello! I actually figured it out! I had to change my data set name! Thank you for all the help, once I changed the named of my data set I was able to use the proc format</description>
      <pubDate>Mon, 26 Apr 2021 14:52:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737005#M21439</guid>
      <dc:creator>RaquelAR</dc:creator>
      <dc:date>2021-04-26T14:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical Data on X Axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737018#M21441</link>
      <description>&lt;P&gt;Hi Reeza,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know if it is possible to use a proc format statement with proc logistic? I would also like to label the x axis the same way but using a graph created by proc logistic&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics on;
proc logistic data=Round3E plots(only)=(effect (clband) oddsratio (type=horizontalstat));
 class Genotype MosquitoStrain(param=ref ref="NO");
 model Alive (event="1") = Genotype MosquitoStrain/clodds=pl;
run;
ods graphics off; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Apr 2021 15:23:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737018#M21441</guid>
      <dc:creator>RaquelAR</dc:creator>
      <dc:date>2021-04-26T15:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical Data on X Axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737022#M21442</link>
      <description>Yes, try it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Mon, 26 Apr 2021 15:36:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737022#M21442</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-04-26T15:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical Data on X Axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737025#M21443</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried this code and got this error message&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;**trying another way to graph estimated prob &amp;amp; CI**;
ods graphics on;
proc logistic data=Round3E plots(only)=(effect (clband) oddsratio (type=horizontalstat));
 format Genotype $GenotFmt.;
 class Genotype MosquitoStrain(param=ref ref="NO")
ORDER='WT,WT' 'WT,HET' 'HET,WT' 'HET,HET' 'MUT,WT' 'WT,MUT' 'HET,MUT' 'MUT,HET' 'MUT,MUT';
 model Alive (event="1") = Genotype MosquitoStrain/clodds=pl;
run;
ods graphics off; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-04-26 at 11.20.30 AM.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58688iE9112EFDEFE5DE08/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2021-04-26 at 11.20.30 AM.png" alt="Screen Shot 2021-04-26 at 11.20.30 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 15:42:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737025#M21443</guid>
      <dc:creator>RaquelAR</dc:creator>
      <dc:date>2021-04-26T15:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical Data on X Axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737029#M21444</link>
      <description>The error is in your ORDER statement, remove that statement. Note that when you use the formatted option you shouldn't require the ORDER= in either of your solutions anymore. If you need further assistance at this point you're going to have to provide a fully worked example that lets us test your code. Or make up fake example data.</description>
      <pubDate>Mon, 26 Apr 2021 15:58:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737029#M21444</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-04-26T15:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical Data on X Axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737055#M21445</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I deleted the order statement and it changed the variable labels but I would like to order them in a specific order (based on their genotype).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Apr 2021 23:49:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737055#M21445</guid>
      <dc:creator>RaquelAR</dc:creator>
      <dc:date>2021-04-28T23:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical Data on X Axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737068#M21446</link>
      <description>Then make sure when you code them, you map them to numbers in the order you want. SAS orders them alphabetically by default.</description>
      <pubDate>Mon, 26 Apr 2021 17:48:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737068#M21446</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-04-26T17:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: Categorical Data on X Axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737076#M21447</link>
      <description>&lt;P&gt;Is there a way to not have them alphabetical? Such as in this graph?? I couldn't figure out a way to do a xaxis label statement in Proc Logistic&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-04-26 at 10.32.28 AM.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58698i88A46DB992609346/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2021-04-26 at 10.32.28 AM.png" alt="Screen Shot 2021-04-26 at 10.32.28 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 18:00:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Categorical-Data-on-X-Axis/m-p/737076#M21447</guid>
      <dc:creator>RaquelAR</dc:creator>
      <dc:date>2021-04-26T18:00:10Z</dc:date>
    </item>
  </channel>
</rss>

