<?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: Invalid reference value in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922662#M41405</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt; Thank you for picking up on that.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Apr 2024 03:28:16 GMT</pubDate>
    <dc:creator>kristiepauly</dc:creator>
    <dc:date>2024-04-03T03:28:16Z</dc:date>
    <item>
      <title>Invalid reference value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922387#M41388</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm hoping you can help with my code below.&amp;nbsp; I ran this on Friday and everything was working so I'm not sure why all of a sudden I'm getting this error message.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I formatted my variables in earlier code. The variable I'm having problems with is diabetes_P1 which I formatted to diabetes_baseline where&amp;nbsp; 0=no and 1 = yes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Proc format;
value BMI_group
0 - &amp;lt;18.5 = Underweight
18.5 - 24.9 = Healthy
25.0 - &amp;lt;30.0 = Overweight
30.0 - 100.0 = Obese
other = missing;
value diabetes_baseline
0 = No
1 = Yes
other = Missing;
value diabetes_final
0 = No
1 = Yes
other = Missing;&lt;/PRE&gt;
&lt;P&gt;I then wrote code to make new variables to calculate the change in Fev1 and Fev1/FVC over time. The problem is in the diabetes_p1 variable in my prc glm&lt;/P&gt;
&lt;PRE&gt;data working4;   ***this works;
	set working3; 
	change_fev1 = fev1pp_Post_p3 - fev1pp_Post_p1;
	change_fev1_FVC = fev1_FVC_post_p3 - Fev1_FVC_post_p1;
	run;

proc glm data=working4;
	class diabetes_P1(ref= '0') finalgold_P1 (ref='0');
	model change_fev1_FVC = diabetes_P1 finalgold_p1 diabetes_P1*finalgold_p1;
	lsmeans diabetes_P1 finalgold_p1 diabetes_P1*finalgold_p1 / pdiff;
	format finalgold_p1 final_gold_stage. diabetes_P1 diabetes_baseline.;
	run;
&lt;STRONG&gt;ERROR: Invalid reference value for Diabetes_P1.&lt;/STRONG&gt;&lt;/PRE&gt;
&lt;P&gt;I tried changing the ref="No" since that is what I formatted it to, but that resulted in the same the error.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I ran proc contents data=working4;&lt;BR /&gt;run;&lt;/P&gt;
&lt;PRE&gt;Alphabetic List of Variables and Attributes
#	Variable	Type	Len	Format	Informat	Label
17	ATS_PackYears_P1	Num	8	 	 	Pack years, from Resp Questionnaire
32	ATS_PackYears_P3	Num	8	 	 	Pack years, from Resp Questionnaire
5	Age_P1	Num	8	 	 	                Age at current visit
19	Age_P3	Num	8	 	 	                Age at current visit
7	BMI_P1	Num	8	 	 	                BMI
21	BMI_P3	Num	8	 	BEST16.	 
34	Change_P1_P3_Smoking_Status	Char	4	 	 Change P1-P3: Smoking Status
12	CortsterOral_P1	Num	8	11.	11.	         Oral corticosteroids
26	CortsterOral_P3	Num	8	 	BEST16.	 
11	Cortsterinhal_P1	Num	8	11.	11.	Inhaled corticosteroids
25	Cortsterinhal_P3	Num	8	BEST12.	BEST16.	 
28	DLco_GLI_pp_PbHb_adj_P3	Num	8	 	 	DLco % predicted GLI, adjusted for Hb and altitude
8	&lt;STRONG&gt;Diabetes_P1	Num	8	11.	11.	         Diabetes&lt;/STRONG&gt;&lt;/PRE&gt;
&lt;P&gt;I tried changing the diabetes_P1 variable to diabetes given that is the label attached to it but then get this:&lt;/P&gt;
&lt;PRE&gt; 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         proc glm data=working4;
 74         class diabetes(ref= 'No') finalgold_P1 (ref='0');
&lt;STRONG&gt; ERROR: Variable DIABETES not found.&lt;/STRONG&gt;
 NOTE: The previous statement has been deleted.
 75         model change_fev1_FVC = diabetes_P1 finalgold_p1 diabetes_P1*finalgold_p1;
 76         lsmeans diabetes_P1 finalgold_p1 diabetes_P1*finalgold_p1 / pdiff;
 &lt;STRONG&gt;ERROR: Only CLASS variables allowed in this effect.&lt;/STRONG&gt;
 NOTE: The previous statement has been deleted.
 77         format finalgold_p1 final_gold_stage. diabetes_P1 diabetes_baseline.;
 78         run;&lt;/PRE&gt;
&lt;P&gt;Any suggestions?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 31 Mar 2024 19:30:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922387#M41388</guid>
      <dc:creator>kristiepauly</dc:creator>
      <dc:date>2024-03-31T19:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid reference value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922389#M41389</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/344524"&gt;@kristiepauly&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reference values must always be specified as &lt;EM&gt;formatted&lt;/EM&gt; values, so&amp;nbsp;&lt;FONT face="courier new,courier"&gt;class diabetes_P1(ref=&lt;FONT size="4" color="#3366FF"&gt;&lt;STRONG&gt;'No'&lt;/STRONG&gt;&lt;/FONT&gt;)&lt;/FONT&gt; ... should work.&lt;/P&gt;</description>
      <pubDate>Sun, 31 Mar 2024 20:19:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922389#M41389</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-03-31T20:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid reference value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922390#M41390</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;. I tried that.&amp;nbsp; It did not work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 31 Mar 2024 21:37:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922390#M41390</guid>
      <dc:creator>kristiepauly</dc:creator>
      <dc:date>2024-03-31T21:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid reference value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922391#M41391</link>
      <description>&lt;P&gt;Then please provide more details of that failed attempt, e.g., the complete log of the PROC GLM step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you've shown so far is&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;diabetes_P1(ref= '0')&lt;/FONT&gt;&amp;nbsp;-- wrong reference value because &lt;FONT face="courier new,courier"&gt;'0'&lt;/FONT&gt; is not among the labels (=formatted values) of format &lt;FONT face="courier new,courier"&gt;diabetes_baseline.&lt;/FONT&gt; (i.e. &lt;FONT face="courier new,courier"&gt;'No'&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;'Yes'&lt;/FONT&gt;).&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face="courier new,courier"&gt;diabetes(ref= 'No')&lt;/FONT&gt;&amp;nbsp;-- wrong variable name, you cannot use the variable label here.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;If&amp;nbsp;&lt;FONT face="courier new,courier"&gt;diabetes_P1(ref='No')&lt;/FONT&gt; is rejected with the same error message "Invalid reference value ...", then your PROC FORMAT step might contain invisible characters. Note that format labels should normally be quoted:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc format;
value BMI_group
0 - &amp;lt;18.5   = &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;"&lt;/FONT&gt;&lt;/STRONG&gt;Underweight&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;
18.5 - 24.9 = &lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;Healthy&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;
...&lt;/PRE&gt;
&lt;P&gt;although omitting the quotes works in most cases. Without the quotes you cannot see the difference, e.g., between &lt;FONT face="courier new,courier"&gt;"No"&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;"No "&lt;/FONT&gt;, where the trailing blank in the latter is in fact a non-breaking space character. In this case &lt;FONT face="courier new,courier"&gt;ref='No'&lt;/FONT&gt;&amp;nbsp;would not work because of that invisible third character in the formatted value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 31 Mar 2024 22:11:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922391#M41391</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-03-31T22:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid reference value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922392#M41392</link>
      <description>&lt;P&gt;Interesting, ref='No' Should work.&amp;nbsp; Maybe double-check the capitalization in your format and ref= to make sure they match?&amp;nbsp; This trivial example works for me:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format ;
  value age
    low-13='No'
    14-high='Yes'
   ;
run ;

proc glm data=sashelp.class ;
  class age(ref='No') ;
  model height=age ;
  format age age. ;
run ;
quit ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Can you post the full log from your PROC FORMAT step and PROC GLM step with ref='No'?&lt;/P&gt;</description>
      <pubDate>Sun, 31 Mar 2024 22:14:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922392#M41392</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-03-31T22:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid reference value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922395#M41393</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;. I deleted the code and rewrote and it works fine now.&amp;nbsp; Gotta love SAS /s.&amp;nbsp;&amp;nbsp;Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 31 Mar 2024 23:39:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922395#M41393</guid>
      <dc:creator>kristiepauly</dc:creator>
      <dc:date>2024-03-31T23:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid reference value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922397#M41394</link>
      <description>&lt;P&gt;When things stop working or for a final test make it a habit to create a new SAS session and re-run everything. This helps you avoid that something you've changed in a previous run in the same SAS session impacts your result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just on a side note: Your format BMI_group will return MISSING for values like 24.95 I assume that's not what you want.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  value BMI_group
    0 - &amp;lt;18.5 = Underweight
    18.5 - 24.9 = Healthy
    25.0 - &amp;lt;30.0 = Overweight
    30.0 - 100.0 = Obese
    other = missing;

  value BMI_group_new
    0    -&amp;lt; 18.5 = 'Underweight'
    18.5 -&amp;lt; 25   = 'Healthy'
    25   -&amp;lt; 30   = 'Overweight'
    30   - 100   = 'Obese'
    other        = 'missing'
    ;
run;

data test;
  input val;
  BMI_group     =put(val,bmi_group.);
  BMI_group_new =put(val,bmi_group_new.);
  datalines;
18.49
18.5
24.89
24.9
24.99
25
29.99
30
30.01
;
run;

proc print data=test;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1711934929807.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95047i2C0C87CD98FA4AD6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1711934929807.png" alt="Patrick_0-1711934929807.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 01:32:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922397#M41394</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-04-01T01:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid reference value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922662#M41405</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt; Thank you for picking up on that.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2024 03:28:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Invalid-reference-value/m-p/922662#M41405</guid>
      <dc:creator>kristiepauly</dc:creator>
      <dc:date>2024-04-03T03:28:16Z</dc:date>
    </item>
  </channel>
</rss>

