<?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: Append into single dataset in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849858#M37182</link>
    <description>Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;. &lt;BR /&gt;Thanks for the information&lt;BR /&gt;Lets say if variables have different lengths in the all of the given data sets.How will i append that data.&lt;BR /&gt;Just to understand how the process works?</description>
    <pubDate>Thu, 15 Dec 2022 13:43:21 GMT</pubDate>
    <dc:creator>animesh123</dc:creator>
    <dc:date>2022-12-15T13:43:21Z</dc:date>
    <item>
      <title>Append into single dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849684#M37145</link>
      <description>If we have 100 Dataset with datset name as day1 , day2 till day100.&lt;BR /&gt;How to append this into single dataset?</description>
      <pubDate>Wed, 14 Dec 2022 16:18:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849684#M37145</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2022-12-14T16:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: Append into single dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849685#M37146</link>
      <description>Does the below code will work? &lt;BR /&gt;Data day;&lt;BR /&gt;Set day1- day100;&lt;BR /&gt;Run;&lt;BR /&gt;</description>
      <pubDate>Wed, 14 Dec 2022 16:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849685#M37146</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2022-12-14T16:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Append into single dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849698#M37150</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/430763"&gt;@animesh123&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Does the below code will work? &lt;BR /&gt;Data day;&lt;BR /&gt;Set day1- day100;&lt;BR /&gt;Run;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It should if three conditions are met:&lt;/P&gt;
&lt;P&gt;1) all the sets are in the work library. If they were in a different library you should be able to use the library name such as: lib.day1 - lib.day100&lt;/P&gt;
&lt;P&gt;2) that sort of list will require continuous numbers without any gaps. If you don't actually have a Day25 for example then it will result in an error but could be gotten around by using actually continuous lists: set day1-day24&amp;nbsp; day26-day100; for example.&lt;/P&gt;
&lt;P&gt;3) and perhaps the most critical: all variables that are in common in the datasets must be of the same type. If any variable is of a different type in some sets then it will generate an error and additional work will be needed. &lt;STRONG&gt;Caution:&lt;/STRONG&gt; if variables have different lengths in the data sets you will get a warning about possible truncation of data. Pay attention because that may result in lost data or unexpected values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Typically problems of different types or lengths occur when using Proc Import or other widget based tool to bring data into SAS. Depending on the source the tools make guesses for type and length based on content for each file and may result in inconsistent characteristics.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that variables that do not occur in other data sets will result in missing values for records from other sets.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 17:24:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849698#M37150</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-12-14T17:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Append into single dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849705#M37151</link>
      <description>&lt;P&gt;Ok ,So what is the efficient way to append in this situtation&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 17:58:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849705#M37151</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2022-12-14T17:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Append into single dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849716#M37152</link>
      <description>&lt;P&gt;Can you describe the situation?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code should work, if it meets&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;'s conditions / warnings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you try the code?&amp;nbsp; If so, did you get an errors?&amp;nbsp; Unexpected results?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 18:37:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849716#M37152</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-12-14T18:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: Append into single dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849857#M37181</link>
      <description>Hey,  I tried the below code&lt;BR /&gt;data want;&lt;BR /&gt;set &lt;span class="lia-unicode-emoji" title=":anguished_face:"&gt;😧&lt;/span&gt; ;&lt;BR /&gt;run;&lt;BR /&gt;As i was getting an unexpected results.&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Dec 2022 13:40:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849857#M37181</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2022-12-15T13:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: Append into single dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849858#M37182</link>
      <description>Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;. &lt;BR /&gt;Thanks for the information&lt;BR /&gt;Lets say if variables have different lengths in the all of the given data sets.How will i append that data.&lt;BR /&gt;Just to understand how the process works?</description>
      <pubDate>Thu, 15 Dec 2022 13:43:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849858#M37182</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2022-12-15T13:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: Append into single dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849859#M37183</link>
      <description>&lt;P&gt;A request was made for you to explain. Just saying code doesn't work explains nothing. Saying you get unexpected results explains nothing. So repeating the request: Explain what the problem is that you are trying to solve. Explain the desired outcome. Explain the undesired results.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2022 13:44:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849859#M37183</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-15T13:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: Append into single dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849892#M37186</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/430763"&gt;@animesh123&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;. &lt;BR /&gt;Thanks for the information&lt;BR /&gt;Lets say if variables have different lengths in the all of the given data sets.How will i append that data.&lt;BR /&gt;Just to understand how the process works?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That would require a LENGTH statement before the SET statement to set the length of those variables to the longest value to avoid any truncation.&lt;/P&gt;
&lt;P&gt;Dummy code:&lt;/P&gt;
&lt;PRE&gt;data want; 
    length thisvar $ 25  thatvar $ 10;
   set set1-set100;
run;&lt;/PRE&gt;
&lt;P&gt;If you don't know, or just want to make sure what the longest value for length is this code can point you to one way to get a report on such. Again creates some small sets to demonstrate;&lt;/P&gt;
&lt;PRE&gt;data set1;
   x='abc';
run;
data set2;
   x='a;sdlfkjasfj';
run;
data set3;
   x='much longer text than other sets';
run;

proc tabulate data=sashelp.vcolumn;
   where libname='WORK' and memname=:'SET';
   class  name;
   var length;
   table name,
         length*max
         ;
run;
&lt;/PRE&gt;
&lt;P&gt;The data view SASHELP.COLUMN contains descriptions of all the variables in all the data sets in the current SAS session.&lt;/P&gt;
&lt;P&gt;To select the data set information you want to specify the LIBNAME and the MEMNAME(s) of interest. In this case the =: is asking for the data set names whose names start with the letters SET. The Libname and Memname information are stored in the view in uppercase. Name, the name of variables, is not. So you may show similar text with different spellings like Var1 and var1 for the identical variable. Pick the largest length value as the data step doesn't which spelling is used but treats all as the same variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SASHELP.VCOLUMN view may take a bit of time to run depending on how many sets and libraries you have so if you don't get a result for the Proc Tabulate code in just a few seconds that may be the reason.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2022 15:56:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849892#M37186</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-12-15T15:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Append into single dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849907#M37187</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/430763"&gt;@animesh123&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;. &lt;BR /&gt;Thanks for the information&lt;BR /&gt;Lets say if variables have different lengths in the all of the given data sets.How will i append that data.&lt;BR /&gt;Just to understand how the process works?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It probably makes more sense to explain the process that creates the datasets and fix that so that they are always created with the same structure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you really had to do something with a bunch of datasets with inconsistently defined variables you probably will want to analyze the variable metadata first.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table variables as 
  select min(varnum) as varnum
       , upcase(name) as name
       , count(*) as nds
       , max(type) as type
       , max(length) as length
  from dictionary.columns
  where libname='SASHELP' and memname like 'CLASS%'
   group by calculated name
   order by 1,2
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Once you have that the list of variables with their intended type and length you can use that to generate a LENGTH statement to define the variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select varnum
     , catx(' ',nliteral(name),cats(case when (type='char') then '$' else ' ' end,length))
  into :varlist, :varlist separated by ' '
  from variables
  order by varnum
;
quit;

data want;
  length &amp;amp;varlist ;
  set sashelp.class: ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Dec 2022 16:23:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/849907#M37187</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-12-15T16:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Append into single dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/850064#M37198</link>
      <description>I have tried using this&lt;BR /&gt;data want;&lt;BR /&gt;set D :  ;&lt;BR /&gt;run;</description>
      <pubDate>Fri, 16 Dec 2022 13:22:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Append-into-single-dataset/m-p/850064#M37198</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2022-12-16T13:22:19Z</dc:date>
    </item>
  </channel>
</rss>

