<?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: combining levels within Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324694#M72101</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/97352"&gt;@AaronJ&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Perhaps i stated my situation incorrectly. The only numeric variable in my dataset is "Slope", while, the rest, including Tree, are categorical variables.&lt;/P&gt;
&lt;P&gt;After my PROC IMPORT statement i have my data statement in which i have;&lt;/P&gt;
&lt;P&gt;data AllEvents;&lt;BR /&gt;set import;&lt;BR /&gt;if Phase=1;&lt;BR /&gt;if Gas='Nitrous Oxide';&lt;BR /&gt;if slope&amp;lt;=0.01 and slope&amp;gt;=-.003;&lt;BR /&gt;logN2O=log(0.1+Slope);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;Then i have a PROC GLM statement to analyze for differences of the categorical variables on Slope, which is now named "logN2O".&lt;/P&gt;
&lt;P&gt;If i include:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;Tree&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;IN&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'I'&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'nI'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; Tree_New&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'I'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;Tree&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;IN&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'n1'&lt;/SPAN&gt; n2&lt;SPAN class="token string"&gt;')  then Tree_New='&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;N&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;';&lt;BR /&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if Tree in ('I' 'nI') then variable = 'I';&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;in the data command, the GLM analysis still include I, nI, n1, and n2, not just I and N.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If i begin a separate PROC FORMAT command;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Proc format;&lt;/P&gt;
&lt;P&gt;value Tree_I_N&lt;/P&gt;
&lt;P&gt;"I", "nI" = "I"&lt;/P&gt;
&lt;P&gt;"n1", "n2" = "N"&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I get an error:&amp;nbsp; ERROR: The quoted string 'I' is not acceptable to a numeric format or informat.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;Sorry, a typo, the format should have a $ preceding the name when character. $Tree_I_N and when used.&lt;/P&gt;
&lt;P&gt;No data=&amp;gt; no code testing agains the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc GLM will use the grouped values if the format is applied in the procedure. Again Format Tree $Tree_I_N. ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Jan 2017 21:00:40 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-01-13T21:00:40Z</dc:date>
    <item>
      <title>combining levels within Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324673#M72092</link>
      <description>&lt;P&gt;I want to compare whether one type of tree is different from another.&lt;/P&gt;&lt;P&gt;Currently i have 4 tree types; I, nI, n1 and n2. I want to reduce these down to 2 types; I and N.&lt;/P&gt;&lt;P&gt;I also want to compare I to all others, to combine nI, n1, and n2 into a single level, N.&lt;/P&gt;&lt;P&gt;This is what i wrote&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data AllEvents;&lt;BR /&gt;set import;&lt;BR /&gt;if Phase=1;&lt;BR /&gt;if Tree='I' 'nI' then 'I';&lt;BR /&gt;if Tree='n1' n2' then 'N';....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and SAS returned an error:&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasError"&gt;ERROR 388-185: Expecting an arithmetic operator.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;How can i write this so that both I and nI will be read as I, and both n1 and n2 will be read as N?&lt;/DIV&gt;</description>
      <pubDate>Fri, 13 Jan 2017 19:07:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324673#M72092</guid>
      <dc:creator>AaronJ</dc:creator>
      <dc:date>2017-01-13T19:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: combining levels within Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324679#M72093</link>
      <description>&lt;P&gt;This is invalid SAS syntax:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if Tree='I' 'nI' then 'I';
if Tree='n1' n2' then 'N';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To check for multiple values in a comparison use the IN operator, ie if TREE in (value1, value2,...)&lt;/P&gt;
&lt;P&gt;To set the new value you need to assign it to a variable, either a new variable or old variable.&lt;/P&gt;
&lt;P&gt;Personally, I always include another value as well so you can verify your code.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;It should be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if Tree IN ('I' 'nI') then Tree_New='I';
else if Tree IN ('n1' n2')  then Tree_New='N';&lt;BR /&gt;else Tree_New='O';&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, 13 Jan 2017 19:20:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324679#M72093</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-13T19:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: combining levels within Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324680#M72094</link>
      <description>&lt;P&gt;If you want to write an IF statement for multiple values then&lt;/P&gt;
&lt;P&gt;if Tree in ('I' 'nI') then variable = 'I';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However you can likely accomplish this without creating any variables or changing your data. Custom formats will group data for analysis procedures.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc format;&lt;/P&gt;
&lt;P&gt;value Tree_I_N&lt;/P&gt;
&lt;P&gt;"I", "nI" = "I"&lt;/P&gt;
&lt;P&gt;"n1", "n2" = "N"&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data =import;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; tables tree;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; format tree tree_I_N.; /*&amp;lt;= says to group the data according the values in the format*/&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create other formats. Note that the values are case sensitive so nI is not equal to NI not equal to ni&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2017 19:19:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324680#M72094</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-13T19:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: combining levels within Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324688#M72096</link>
      <description>&lt;P&gt;A wild thought hinted by your incoming dataset name 'import'. If you want to work that out at the source level:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc format;
invalue $ Tree_I_N
"I", "nI" = "I"
"n1", "n2" = "N"
;
run;


data raw;
input tree :$tree_i_n2. @@;
cards;
I nI n1 n2
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Format snippet partially stolen from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;:).&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2017 20:01:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324688#M72096</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2017-01-13T20:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: combining levels within Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324689#M72097</link>
      <description>&lt;P&gt;Perhaps i stated my situation incorrectly. The only numeric variable in my dataset is "Slope", while, the rest, including Tree, are categorical variables.&lt;/P&gt;&lt;P&gt;After my PROC IMPORT statement i have my data statement in which i have;&lt;/P&gt;&lt;P&gt;data AllEvents;&lt;BR /&gt;set import;&lt;BR /&gt;if Phase=1;&lt;BR /&gt;if Gas='Nitrous Oxide';&lt;BR /&gt;if slope&amp;lt;=0.01 and slope&amp;gt;=-.003;&lt;BR /&gt;logN2O=log(0.1+Slope);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;Then i have a PROC GLM statement to analyze for differences of the categorical variables on Slope, which is now named "logN2O".&lt;/P&gt;&lt;P&gt;If i include:&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;Tree&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;IN&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'I'&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'nI'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; Tree_New&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'I'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;Tree&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;IN&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'n1'&lt;/SPAN&gt; n2&lt;SPAN class="token string"&gt;')  then Tree_New='&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;N&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;';&lt;BR /&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;or&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if Tree in ('I' 'nI') then variable = 'I';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;in the data command, the GLM analysis still include I, nI, n1, and n2, not just I and N.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If i begin a separate PROC FORMAT command;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Proc format;&lt;/P&gt;&lt;P&gt;value Tree_I_N&lt;/P&gt;&lt;P&gt;"I", "nI" = "I"&lt;/P&gt;&lt;P&gt;"n1", "n2" = "N"&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I get an error:&amp;nbsp; ERROR: The quoted string 'I' is not acceptable to a numeric format or informat.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2017 20:07:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324689#M72097</guid>
      <dc:creator>AaronJ</dc:creator>
      <dc:date>2017-01-13T20:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: combining levels within Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324691#M72098</link>
      <description>&lt;P&gt;Show all of your code and log, not piecewise.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2017 20:23:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324691#M72098</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-13T20:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: combining levels within Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324692#M72099</link>
      <description>&lt;P&gt;This is the whole code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%web_drop_table(WORK.IMPORT);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;FILENAME FILEREF '/folders/myshortcuts/MyFolders/AllEvents.xlsx';&lt;/P&gt;&lt;P&gt;PROC IMPORT DATAFILE=FILEREF&lt;BR /&gt;DBMS=XLSX&lt;BR /&gt;OUT=WORK.IMPORT;&lt;BR /&gt;GETNAMES=YES;&lt;BR /&gt;RUN;&lt;BR /&gt;data AllEvents;&lt;BR /&gt;set import;&lt;BR /&gt;if Phase=1;&lt;BR /&gt;if Gas='Methane';&lt;BR /&gt;if slope&amp;lt;=0.0668 and slope&amp;gt;=-.03;&lt;BR /&gt;logCH4=log(0.1+Slope);&lt;BR /&gt;run;&lt;BR /&gt;proc sort data=AllEvents;&lt;BR /&gt;by Block Fert Nfix Tree Distance;&lt;BR /&gt;run;&lt;BR /&gt;/*proc print data=AllEvents;&lt;BR /&gt;run;*/&lt;BR /&gt;Proc sort;&lt;BR /&gt;by Fert Nfix;&lt;BR /&gt;run;&lt;BR /&gt;proc univariate Normal Plot data=AllEvents;&lt;BR /&gt;/*by Fert Nfix;*/&lt;BR /&gt;var Slope logCH4;&lt;BR /&gt;Histogram Slope logCH4/Normal;&lt;BR /&gt;QQPLOT Slope logCH4;&lt;BR /&gt;output out=AllEvents2;&lt;BR /&gt;run;&lt;BR /&gt;proc sort data=AllEvents;&lt;BR /&gt;by Gas Phase Block Fert Nfix Tree Distance;&lt;BR /&gt;run;&lt;BR /&gt;proc glm;&lt;BR /&gt;class Block Fert Nfix Tree Distance;&lt;BR /&gt;Model LogCH4=block Fert Tree Distance Block*Fert Block*Tree Fert* Tree Tree*Distance;&lt;BR /&gt;Test h=Fert e=Fert*Tree;&lt;BR /&gt;lsmeans Fert Tree Distance Tree*Distance/pdiff adjust=tukey;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2017 20:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324692#M72099</guid>
      <dc:creator>AaronJ</dc:creator>
      <dc:date>2017-01-13T20:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: combining levels within Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324694#M72101</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/97352"&gt;@AaronJ&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Perhaps i stated my situation incorrectly. The only numeric variable in my dataset is "Slope", while, the rest, including Tree, are categorical variables.&lt;/P&gt;
&lt;P&gt;After my PROC IMPORT statement i have my data statement in which i have;&lt;/P&gt;
&lt;P&gt;data AllEvents;&lt;BR /&gt;set import;&lt;BR /&gt;if Phase=1;&lt;BR /&gt;if Gas='Nitrous Oxide';&lt;BR /&gt;if slope&amp;lt;=0.01 and slope&amp;gt;=-.003;&lt;BR /&gt;logN2O=log(0.1+Slope);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;Then i have a PROC GLM statement to analyze for differences of the categorical variables on Slope, which is now named "logN2O".&lt;/P&gt;
&lt;P&gt;If i include:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;Tree&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;IN&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'I'&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'nI'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; Tree_New&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'I'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;Tree&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;IN&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'n1'&lt;/SPAN&gt; n2&lt;SPAN class="token string"&gt;')  then Tree_New='&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;N&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;';&lt;BR /&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if Tree in ('I' 'nI') then variable = 'I';&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;in the data command, the GLM analysis still include I, nI, n1, and n2, not just I and N.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If i begin a separate PROC FORMAT command;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Proc format;&lt;/P&gt;
&lt;P&gt;value Tree_I_N&lt;/P&gt;
&lt;P&gt;"I", "nI" = "I"&lt;/P&gt;
&lt;P&gt;"n1", "n2" = "N"&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I get an error:&amp;nbsp; ERROR: The quoted string 'I' is not acceptable to a numeric format or informat.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;Sorry, a typo, the format should have a $ preceding the name when character. $Tree_I_N and when used.&lt;/P&gt;
&lt;P&gt;No data=&amp;gt; no code testing agains the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc GLM will use the grouped values if the format is applied in the procedure. Again Format Tree $Tree_I_N. ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2017 21:00:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324694#M72101</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-13T21:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: combining levels within Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324695#M72102</link>
      <description>&lt;P&gt;Replace this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data AllEvents;
set import;
if Phase=1;
if Gas='Methane';
if slope&amp;lt;=0.0668 and slope&amp;gt;=-.03;
logCH4=log(0.1+Slope);

if Tree IN ('I' 'nI') then Tree_New='I';
else if Tree IN ('n1' n2')  then Tree_New='N';

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then in the remaining code, replace all references to Tree with Tree_New.&lt;/P&gt;
&lt;P&gt;That's all.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2017 20:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-levels-within-Variable/m-p/324695#M72102</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-13T20:50:03Z</dc:date>
    </item>
  </channel>
</rss>

