<?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: How do I create a a value label with single quotes within it? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-create-a-a-value-label-with-single-quotes-within-it/m-p/816567#M34327</link>
    <description>&lt;P&gt;Thanks for your help, Tom.&lt;/P&gt;&lt;P&gt;The missing semicolon was a typo.&lt;/P&gt;&lt;P&gt;I can confirm that the graph does have enough room for the string, as longer strings are present and display fine. Additionally, if I change the code to:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;PROC FORMAT;
VALUE  $VariableF
"DangerArea"	=	"'High Danger Area'";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then I get:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'High Danger Area'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your suggestion about the width being the issue is probably on the right track. I previously had a problem with many different variable names (formats) being truncated and finally realized it was because the dataset had a variable length of $16, so any names I had assigned that were more than 16 characters were being truncated. This was a confusing problem for me because the formats displayed fine when assigning the labels:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;DATA LabeledDataset;
	set NewDataset;
	FORMAT variable $VariableF.;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, I noticed that the variable had a length of 16.&amp;nbsp;To try and fix that issue, I included the following code before the PROC FORMAT statement:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Data NewDataset;
	Length Variable $32;
	Merge Dataset1 Dataset2;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;That fixed the truncation of all of my 16+ character labels, but the issue mentioned in the OP remains. Can you give any other hints at what might be the problem?&lt;/P&gt;</description>
    <pubDate>Sun, 05 Jun 2022 21:12:48 GMT</pubDate>
    <dc:creator>samp945</dc:creator>
    <dc:date>2022-06-05T21:12:48Z</dc:date>
    <item>
      <title>How do I create a a value label with single quotes within it?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-create-a-a-value-label-with-single-quotes-within-it/m-p/816565#M34325</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to assign value labels to a dataset so that a graph is labelled with these values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One of my value labels is a string with two quotes within it. It doesn't actually matter to me if the quotes are double or single. The string that I want is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"High Danger" Area&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The relevant code that I've written is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;PROC FORMAT;
VALUE  $VariableF
"DangerArea"	=	"'High Danger' Area"
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The value label shows up in the graph as:&lt;/P&gt;&lt;P&gt;'High Danger'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In other words, the last part of the value label ("Area") is truncated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will someone be so kind as to explain what I'm doing wrong? Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 20:45:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-create-a-a-value-label-with-single-quotes-within-it/m-p/816565#M34325</guid>
      <dc:creator>samp945</dc:creator>
      <dc:date>2022-06-05T20:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a a value label with single quotes within it?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-create-a-a-value-label-with-single-quotes-within-it/m-p/816566#M34326</link>
      <description>&lt;P&gt;"value label" is SPSS terminology.&amp;nbsp; In SAS terminology only variables or dataset can have labels.&amp;nbsp; To change how values are displayed you change the format that they use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your FORMAT definition looks valid (other than missing the closing semicolon for the VALUE statement).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You probably used the wrong WIDTH on the format.&amp;nbsp; Or the graph did not have room for such a long string.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 20:58:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-create-a-a-value-label-with-single-quotes-within-it/m-p/816566#M34326</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-05T20:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a a value label with single quotes within it?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-create-a-a-value-label-with-single-quotes-within-it/m-p/816567#M34327</link>
      <description>&lt;P&gt;Thanks for your help, Tom.&lt;/P&gt;&lt;P&gt;The missing semicolon was a typo.&lt;/P&gt;&lt;P&gt;I can confirm that the graph does have enough room for the string, as longer strings are present and display fine. Additionally, if I change the code to:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;PROC FORMAT;
VALUE  $VariableF
"DangerArea"	=	"'High Danger Area'";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then I get:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'High Danger Area'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your suggestion about the width being the issue is probably on the right track. I previously had a problem with many different variable names (formats) being truncated and finally realized it was because the dataset had a variable length of $16, so any names I had assigned that were more than 16 characters were being truncated. This was a confusing problem for me because the formats displayed fine when assigning the labels:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;DATA LabeledDataset;
	set NewDataset;
	FORMAT variable $VariableF.;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, I noticed that the variable had a length of 16.&amp;nbsp;To try and fix that issue, I included the following code before the PROC FORMAT statement:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Data NewDataset;
	Length Variable $32;
	Merge Dataset1 Dataset2;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;That fixed the truncation of all of my 16+ character labels, but the issue mentioned in the OP remains. Can you give any other hints at what might be the problem?&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 21:12:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-create-a-a-value-label-with-single-quotes-within-it/m-p/816567#M34327</guid>
      <dc:creator>samp945</dc:creator>
      <dc:date>2022-06-05T21:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a a value label with single quotes within it?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-create-a-a-value-label-with-single-quotes-within-it/m-p/816571#M34328</link>
      <description>&lt;P&gt;SAS is doing the best it can to figure out what length to use.&amp;nbsp; However, you can take matters into your own hands.&amp;nbsp; Replace this statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FORMAT variable $VariableF.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Instead, specify the width you would like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FORMAT variable $VariableF18.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That should fix the problem.&amp;nbsp; On a side note, you are allowed to add a width as in this example.&amp;nbsp; That's the reason when you create a format you are not allowed to end the format name with a number.&amp;nbsp; It gives you the flexibility to specify a width later when using the format.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 22:41:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-create-a-a-value-label-with-single-quotes-within-it/m-p/816571#M34328</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-06-05T22:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a a value label with single quotes within it?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-create-a-a-value-label-with-single-quotes-within-it/m-p/816572#M34329</link>
      <description>&lt;P&gt;Changing the LENGTH of a the variable (how much space it takes to store it) is different than changing the WIDTH of the format (how much space it takes to display it).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you define that format you can set both a default width and a maximum width.&amp;nbsp; If you don't specify either then SAS will set them both to the width of the longest display value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format ;
 value $gender 'M'='Male' 'F'='Female';
run;

proc freq data=sashelp.class;
  tables sex / list;
  format sex $gender.;
run;
proc freq data=sashelp.class;
  tables sex / list;
  format sex $gender4.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1654468825253.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71999iE25B52FD6A5F5A71/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1654468825253.png" alt="Tom_0-1654468825253.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For more help on your graph post the actual code (or better SAS log) of what you ran.&amp;nbsp; There could also be limitations of the procedure you are using that is causing the truncation so knowing exactly what you ran would help.&amp;nbsp; Best would be if you could post a simple example of data and code that reproduces the problem.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 22:43:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-create-a-a-value-label-with-single-quotes-within-it/m-p/816572#M34329</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-05T22:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a a value label with single quotes within it?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-create-a-a-value-label-with-single-quotes-within-it/m-p/816574#M34330</link>
      <description>&lt;P&gt;Below sample prints the variable value as desired when I run it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC FORMAT;
  VALUE  $VariableF
    "DangerArea"  = "'High Danger' Area"
  ;
run;

data have;
  var='DangerArea';
run;

proc print data=have;
  format var $VariableF.;
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-1654469269110.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72000i90EA421FB45A4242/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1654469269110.png" alt="Patrick_0-1654469269110.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Can you please execute above code and let us know if you get the same result or if the string truncation you observe also happens here for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If above code works for you then please share some fully working sample code that shows the issue you describe so we can replicate and investigate what's happening.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 22:53:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-create-a-a-value-label-with-single-quotes-within-it/m-p/816574#M34330</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-06-05T22:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a a value label with single quotes within it?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-create-a-a-value-label-with-single-quotes-within-it/m-p/816592#M34333</link>
      <description>&lt;P&gt;Please provide some example data and the graphics code you run, so we can recreate the issue. It might very well be that you have stumbled across a SAS bug.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 06:20:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-create-a-a-value-label-with-single-quotes-within-it/m-p/816592#M34333</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-06-06T06:20:11Z</dc:date>
    </item>
  </channel>
</rss>

