<?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: Proc transpose of character variable name and label in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-transpose-of-character-variable-name-and-label/m-p/646616#M193465</link>
    <description>&lt;P&gt;Thanks! I just figured it out myself two minutes ago &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Although the proc transpose need to be as below for it to give the desired results...&lt;/P&gt;&lt;P&gt;proc transpose data=have2 out=want (drop=_:);&lt;BR /&gt;var answer;&lt;BR /&gt;id question_unf;&lt;BR /&gt;idlabel question;&lt;BR /&gt;by id;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Mon, 11 May 2020 10:44:51 GMT</pubDate>
    <dc:creator>andypandy_swe</dc:creator>
    <dc:date>2020-05-11T10:44:51Z</dc:date>
    <item>
      <title>Proc transpose of character variable name and label</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-transpose-of-character-variable-name-and-label/m-p/646589#M193461</link>
      <description>&lt;P&gt;I've got a dataset containing three variables (ID, QUESTION, ANSWER) and I want to transpose QUESTION (long to wide).&lt;/P&gt;&lt;P&gt;QUESTION is a character variable with a character format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The desired result is a dataset with the variables ID, FIRST_QUESTION, ANOTHER_QUESTION, LAST_QUESTION (this are the unformatted values of QUESTION.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I would like the formatted values of QUESTION to be the labels of the transposed variables.&lt;/P&gt;&lt;P&gt;If I just do a proc transpose I get the formatted values as the names of the transposed variables. So it's:&lt;/P&gt;&lt;P&gt;ID, This is the first question, Now let's answer another, Finally the last one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can get the unformatted values by removing the format before transposing but then I can't get the formatted values as labels...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 09:09:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-transpose-of-character-variable-name-and-label/m-p/646589#M193461</guid>
      <dc:creator>andypandy_swe</dc:creator>
      <dc:date>2020-05-11T09:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: Proc transpose of character variable name and label</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-transpose-of-character-variable-name-and-label/m-p/646594#M193462</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/141876"&gt;@andypandy_swe&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest that you run a preliminary data step so as to create a second variable equivalent to QUESTION, but with unformatted values.&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
	value $ Fquestion "a" = "aaa"
					  "b" = "bbb"
					  "c" = "ccc";
run;

data have;
	input ID QUESTION $ ANSWER $;
	format QUESTION $Fquestion.;
	datalines;
1 a xxx
1 b yyy
1 c zzz
2 a aaa
2 b bbb
2 c ccc
;
run;

data have2;
	set have;
	format QUESTION $Fquestion. question_unf;
	question_unf = QUESTION;
run;
	
proc transpose data=have2 out=want (drop=_:);
	var question_unf;
	id question;
	by id;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 May 2020 09:32:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-transpose-of-character-variable-name-and-label/m-p/646594#M193462</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-11T09:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Proc transpose of character variable name and label</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-transpose-of-character-variable-name-and-label/m-p/646616#M193465</link>
      <description>&lt;P&gt;Thanks! I just figured it out myself two minutes ago &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Although the proc transpose need to be as below for it to give the desired results...&lt;/P&gt;&lt;P&gt;proc transpose data=have2 out=want (drop=_:);&lt;BR /&gt;var answer;&lt;BR /&gt;id question_unf;&lt;BR /&gt;idlabel question;&lt;BR /&gt;by id;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 10:44:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-transpose-of-character-variable-name-and-label/m-p/646616#M193465</guid>
      <dc:creator>andypandy_swe</dc:creator>
      <dc:date>2020-05-11T10:44:51Z</dc:date>
    </item>
  </channel>
</rss>

