<?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: $LIKERT not working in SAS code in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/LIKERT-not-working-in-SAS-code/m-p/851478#M10735</link>
    <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;I used both responders' suggestions as the text file was not already in a library and needed the Data and Infile/INPUT and Obviously now I know - the length statements.&lt;/P&gt;&lt;P&gt;SO, my final solution was removing the single quotations from the values 1-5 in $LIKERT and I also included the $ after the Ques1-Ques5 in the INPUT statement.&amp;nbsp; I tried one suggestion then the other, but Both adjustments together worked perfectly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA Learn.survey;&lt;BR /&gt;	INFILE '/home/u6240xxxx/LEARN/survey.txt';&lt;BR /&gt;	length ID 8 Gender $8 Age Salary 8 Ques1-Ques5 $1 ;&lt;BR /&gt;	INPUT ID Gender $ Age Salary Ques1-Ques5;&lt;BR /&gt;RUN;&lt;BR /&gt;LIBNAME Learn '/home/u6240xxxx/Z_LearnOutput';&lt;BR /&gt;PROC FORMAT;&lt;BR /&gt;	value $Gender 'M' = 'Male'&lt;BR /&gt;				  'F' = 'Female'&lt;BR /&gt;				  ' ' = 'Not entered'&lt;BR /&gt;				other = 'Miscoded';&lt;BR /&gt;	value Age low-29  = 'Less than 30'&lt;BR /&gt;			  30-50   = '30 to 50'&lt;BR /&gt;			  51-high = '51+';&lt;BR /&gt;	value $Likert  1 = 'Str Disagree'&lt;BR /&gt;				   2 = 'Disagree'&lt;BR /&gt;				   3 = 'No Opinion'&lt;BR /&gt;				   4 = 'Agree'&lt;BR /&gt;				   5 = 'Str Agree';&lt;BR /&gt;RUN;&lt;BR /&gt;Title "Data Set SURVEY with Formatted Values";&lt;BR /&gt;PROC PRINT Data=Learn.survey;&lt;BR /&gt;	id ID;&lt;BR /&gt;	VAR Gender Age Salary Ques1-Ques5;&lt;BR /&gt;	Format Gender		$Gender.&lt;BR /&gt;	       Age			Age.&lt;BR /&gt;	       Ques1-Ques5	$Likert.&lt;BR /&gt;	       Salary		Dollar11.2;&lt;BR /&gt;RUN;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had numeric data ques(1-5) that I needed to be the char data depicted in the code. He started w/ the PROC FORMAT so I was unsure on how to get the file read.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you both so MUCH!! Lesson Learned!! - KBA&lt;/P&gt;</description>
    <pubDate>Thu, 29 Dec 2022 05:11:27 GMT</pubDate>
    <dc:creator>KateBA715</dc:creator>
    <dc:date>2022-12-29T05:11:27Z</dc:date>
    <item>
      <title>$LIKERT not working in SAS code</title>
      <link>https://communities.sas.com/t5/SAS-Studio/LIKERT-not-working-in-SAS-code/m-p/851471#M10731</link>
      <description>&lt;P&gt;I have copied the code from Learning SAS by Example to a T. But I keep getting an error (5 errors actually) telling me:&lt;/P&gt;&lt;DIV class=""&gt;ERROR: You are trying to use the character format $LIKERT with the numeric variable Ques5 in data set LEARN.SURVEY.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Here is the code:&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;DATA learn.Survey;&lt;BR /&gt;	INFILE '/home/u6240xxxx/LEARN/survey.txt';&lt;BR /&gt;	INPUT ID Gender $ Age Salary Ques1-Ques5;&lt;BR /&gt;RUN;&lt;BR /&gt;LIBNAME Learn '/home/u624xxxx/Z_LearnOutput';&lt;BR /&gt;PROC FORMAT;&lt;BR /&gt;	value $Gender 'M' = 'Male'&lt;BR /&gt;				  'F' = 'Female'&lt;BR /&gt;				  ' ' = 'Not entered'&lt;BR /&gt;				other = 'Miscoded';&lt;BR /&gt;	value Age low-29  = 'Less than 30'&lt;BR /&gt;			  30-50   = '30 to 50'&lt;BR /&gt;			  51-high = '51+';&lt;BR /&gt;	value $Likert '1' = 'Str Disagree'&lt;BR /&gt;				  '2' = 'Disagree'&lt;BR /&gt;				  '3' = 'No Opinion'&lt;BR /&gt;				  '4' = 'Agree'&lt;BR /&gt;				  '5' = 'Str Agree';&lt;BR /&gt;RUN;&lt;BR /&gt;Title "Data Set SURVEY with Formatted Values";&lt;BR /&gt;PROC PRINT Data=Learn.survey;&lt;BR /&gt;	id ID;&lt;BR /&gt;	VAR Gender Age Salary Ques1-Ques5;&lt;BR /&gt;	Format Gender		$Gender.&lt;BR /&gt;	       Age			Age.&lt;BR /&gt;	       Ques1-Ques5	$Likert.&lt;BR /&gt;	       Salary		Dollar11.2;&lt;BR /&gt;RUN;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;a) I have had to fix errors from the text prior to this problem in order to get codes to work (Mostly widths)&lt;/DIV&gt;&lt;DIV class=""&gt;b) Any other option besides $LIKERT ?&lt;/DIV&gt;&lt;DIV class=""&gt;c) THANK YOU!&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 29 Dec 2022 04:24:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/LIKERT-not-working-in-SAS-code/m-p/851471#M10731</guid>
      <dc:creator>KateBA715</dc:creator>
      <dc:date>2022-12-29T04:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: $LIKERT not working in SAS code</title>
      <link>https://communities.sas.com/t5/SAS-Studio/LIKERT-not-working-in-SAS-code/m-p/851473#M10732</link>
      <description>&lt;P&gt;In the first DATA step, the statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	INPUT ID Gender $ Age Salary Ques1-Ques5;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;implies that the variables Ques1 through Ques5 are numeric.&amp;nbsp; But the $likert format is applicable only to character variables.&amp;nbsp; Most likely the INPUT statement would need to be changed to read QUES1-QUES5 as character variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Dec 2022 04:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/LIKERT-not-working-in-SAS-code/m-p/851473#M10732</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-12-29T04:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: $LIKERT not working in SAS code</title>
      <link>https://communities.sas.com/t5/SAS-Studio/LIKERT-not-working-in-SAS-code/m-p/851475#M10733</link>
      <description>&lt;P&gt;You are trying to attach a CHARACTER format to NUMERIC variables.&lt;/P&gt;
&lt;P&gt;So which do you want to fix?&lt;/P&gt;
&lt;P&gt;Do you want to define the format as a NUMERIC format?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;value Likert
 1 = 'Str Disagree'
 2 = 'Disagree'
 3 = 'No Opinion'
 4 = 'Agree'
 5 = 'Str Agree'
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do you want to define the variables as CHARACTER variables?&lt;/P&gt;
&lt;P&gt;Either define them as character with a LENGTH statement&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA learn.Survey;
  INFILE '/home/u6240xxxx/LEARN/survey.txt';
  length ID 8 Gender $8 Age Salary 8 Ques1-Ques5 $1 ;
  INPUT ID Gender Age Salary Ques1-Ques5;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or use a CHARACTER informat when reading them with the INPUT statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA learn.Survey;
  INFILE '/home/u6240xxxx/LEARN/survey.txt';
  INPUT ID Gender :$8. Age Salary (Ques1-Ques5) (:$1.);
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Dec 2022 04:39:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/LIKERT-not-working-in-SAS-code/m-p/851475#M10733</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-12-29T04:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: $LIKERT not working in SAS code</title>
      <link>https://communities.sas.com/t5/SAS-Studio/LIKERT-not-working-in-SAS-code/m-p/851478#M10735</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;I used both responders' suggestions as the text file was not already in a library and needed the Data and Infile/INPUT and Obviously now I know - the length statements.&lt;/P&gt;&lt;P&gt;SO, my final solution was removing the single quotations from the values 1-5 in $LIKERT and I also included the $ after the Ques1-Ques5 in the INPUT statement.&amp;nbsp; I tried one suggestion then the other, but Both adjustments together worked perfectly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA Learn.survey;&lt;BR /&gt;	INFILE '/home/u6240xxxx/LEARN/survey.txt';&lt;BR /&gt;	length ID 8 Gender $8 Age Salary 8 Ques1-Ques5 $1 ;&lt;BR /&gt;	INPUT ID Gender $ Age Salary Ques1-Ques5;&lt;BR /&gt;RUN;&lt;BR /&gt;LIBNAME Learn '/home/u6240xxxx/Z_LearnOutput';&lt;BR /&gt;PROC FORMAT;&lt;BR /&gt;	value $Gender 'M' = 'Male'&lt;BR /&gt;				  'F' = 'Female'&lt;BR /&gt;				  ' ' = 'Not entered'&lt;BR /&gt;				other = 'Miscoded';&lt;BR /&gt;	value Age low-29  = 'Less than 30'&lt;BR /&gt;			  30-50   = '30 to 50'&lt;BR /&gt;			  51-high = '51+';&lt;BR /&gt;	value $Likert  1 = 'Str Disagree'&lt;BR /&gt;				   2 = 'Disagree'&lt;BR /&gt;				   3 = 'No Opinion'&lt;BR /&gt;				   4 = 'Agree'&lt;BR /&gt;				   5 = 'Str Agree';&lt;BR /&gt;RUN;&lt;BR /&gt;Title "Data Set SURVEY with Formatted Values";&lt;BR /&gt;PROC PRINT Data=Learn.survey;&lt;BR /&gt;	id ID;&lt;BR /&gt;	VAR Gender Age Salary Ques1-Ques5;&lt;BR /&gt;	Format Gender		$Gender.&lt;BR /&gt;	       Age			Age.&lt;BR /&gt;	       Ques1-Ques5	$Likert.&lt;BR /&gt;	       Salary		Dollar11.2;&lt;BR /&gt;RUN;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had numeric data ques(1-5) that I needed to be the char data depicted in the code. He started w/ the PROC FORMAT so I was unsure on how to get the file read.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you both so MUCH!! Lesson Learned!! - KBA&lt;/P&gt;</description>
      <pubDate>Thu, 29 Dec 2022 05:11:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/LIKERT-not-working-in-SAS-code/m-p/851478#M10735</guid>
      <dc:creator>KateBA715</dc:creator>
      <dc:date>2022-12-29T05:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: $LIKERT not working in SAS code</title>
      <link>https://communities.sas.com/t5/SAS-Studio/LIKERT-not-working-in-SAS-code/m-p/851479#M10736</link>
      <description>Thank you! Like a charm!!</description>
      <pubDate>Thu, 29 Dec 2022 05:12:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/LIKERT-not-working-in-SAS-code/m-p/851479#M10736</guid>
      <dc:creator>KateBA715</dc:creator>
      <dc:date>2022-12-29T05:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: $LIKERT not working in SAS code</title>
      <link>https://communities.sas.com/t5/SAS-Studio/LIKERT-not-working-in-SAS-code/m-p/851480#M10737</link>
      <description>&lt;P&gt;Removing the quotes from the format statement, without removing the $ from the name, will just confuse the HUMANS that need to read and understand your code.&amp;nbsp; SAS will know that you meant to create a CHARACTER format because the name starts with a $, so it will convert the NUMERIC range values into CHARACTER range values.&amp;nbsp; Save yourself some confusion by keeping the quotes if you want to define a CHARACTER format.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Dec 2022 05:18:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/LIKERT-not-working-in-SAS-code/m-p/851480#M10737</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-12-29T05:18:39Z</dc:date>
    </item>
  </channel>
</rss>

