<?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: Wide Dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Wide-Dataset/m-p/895932#M353984</link>
    <description>&lt;P&gt;181 + 362 = 543&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So none of the values of SUBCLASS that are in WIDE1 are in WIDE2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want the values to merge they have to match.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Sep 2023 17:44:22 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-09-26T17:44:22Z</dc:date>
    <item>
      <title>Wide Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wide-Dataset/m-p/895931#M353983</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using SAS 9.4, I am running the following code to try and create a wide data set for a matched analysis. I have 1 linking variable "subclass". I have renamed all variables from the 2nd data set with the suffix "_wide". The goal is to create 1 data with set all variables and their _wide counterpart (i.e. sex and sex_wide) from both observations with the same subclass. When I run the merge statement at the end, all of the data from "_wide" data set is missing. Any help on how I can correct this issue would be greatly appreciate. Thank you&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data wide1;
	set ing.analysis;
	if subclass in: ('1') then output;
run;*NOTE: The data set WORK.WIDE1 has 181 observations and 84 variables.;

data wide2;
	set ing.analysis;
	if subclass in: ('2') then output;
run;*NOTE: The data set WORK.WIDE2 has 362 observations and 84 variables.;

*add suffix to end of matched variables;
proc sql;
 select cats(name,'=',name,'_wide') AS  wide2
          into :list
          separated by ' '
          from dictionary.columns
          where libname = 'WORK' and memname = 'WIDE2';
quit;

data  wide2;
	set wide2 (rename = (&amp;amp;list));
	rename subclass_wide = subclass;
run;*NOTE: The data set WORK.WIDE2 has 362 observations and 84 variables.;

proc sort data= wide1;	
	by subclass;
run;
proc sort data= wide2;	
	by subclass;
run;

data ing.wide_analysis;
	merge wide1 wide2;
	by subclass;
run;*NOTE: There were 181 observations read from the data set WORK.WIDE1.
NOTE: There were 362 observations read from the data set WORK.WIDE2.
NOTE: The data set ING.WIDE_ANALYSIS has 543 observations and 167 variables.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Sep 2023 17:30:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wide-Dataset/m-p/895931#M353983</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2023-09-26T17:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Wide Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wide-Dataset/m-p/895932#M353984</link>
      <description>&lt;P&gt;181 + 362 = 543&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So none of the values of SUBCLASS that are in WIDE1 are in WIDE2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want the values to merge they have to match.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 17:44:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wide-Dataset/m-p/895932#M353984</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-09-26T17:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Wide Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wide-Dataset/m-p/895938#M353987</link>
      <description>Thank you. That was an oversight on my part.</description>
      <pubDate>Tue, 26 Sep 2023 18:10:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wide-Dataset/m-p/895938#M353987</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2023-09-26T18:10:24Z</dc:date>
    </item>
  </channel>
</rss>

