<?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 Combining/Merging Three datasets in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57092#M15934</link>
    <description>Hello ,&lt;BR /&gt;
&lt;BR /&gt;
could someone please help me out.I've sales data with variables Date of Sale, Number of units sold and the Laptop model ( there are two A and B ).I've three raw data files called :&lt;BR /&gt;
Period 1 sales , Period 2 Sales_A, Period 2 Sales_B.&lt;BR /&gt;
&lt;BR /&gt;
I used the following code to first obtain the raw data in proper format :&lt;BR /&gt;
&lt;BR /&gt;
libname sc 'h:\SAScourse';&lt;BR /&gt;
data Period1Sales;&lt;BR /&gt;
	infile  'h:\SAScourse\period1_sales_data.dat';&lt;BR /&gt;
	input  TransactionID        $1-8&lt;BR /&gt;
		 DateofSale	    $9-18&lt;BR /&gt;
		TimeofSale	    $19-26&lt;BR /&gt;
		LaptopModel	    $27-32&lt;BR /&gt;
		UnitsSold	    33-35&lt;BR /&gt;
		Warranty        36;&lt;BR /&gt;
proc print data = Period1Sales;&lt;BR /&gt;
TITLE 'period1_sales_data.dat';&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
data period2_sales_data_A;&lt;BR /&gt;
	infile 'h:\SAScourse\period2_sales_data_A.dat';&lt;BR /&gt;
	Input 	TransactionID $1-8&lt;BR /&gt;
			DateofSale	  $9-18&lt;BR /&gt;
			LaptopModel   $19-24&lt;BR /&gt;
			UnitsSold      25-27&lt;BR /&gt;
			Warranty       28;&lt;BR /&gt;
proc print data=period2_sales_data_A;&lt;BR /&gt;
TITLE 'period2_sales_data_A';&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
data period2_sales_data_B;&lt;BR /&gt;
infile 'h:\SAScourse\period2_sales_data_B.dat';&lt;BR /&gt;
Input      TransactionID   	 $1-8&lt;BR /&gt;
	     TimeofSale	        $9-16;&lt;BR /&gt;
			&lt;BR /&gt;
proc print data=period2_sales_data_B;&lt;BR /&gt;
TITLE 'period2_sales_data_B';&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
There was no problems with the first and third codes , but the 2nd code for the raw data file period2_sales_data_A is showing 0 obseravations selected . I get the varables but with no entries in them.&lt;BR /&gt;
&lt;BR /&gt;
Also , is there a way to combine/merge all three raw data files into one file to analyse the data.&lt;BR /&gt;
&lt;BR /&gt;
Regards ,&lt;BR /&gt;
mark</description>
    <pubDate>Sun, 14 Feb 2010 06:02:55 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-02-14T06:02:55Z</dc:date>
    <item>
      <title>Combining/Merging Three datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57092#M15934</link>
      <description>Hello ,&lt;BR /&gt;
&lt;BR /&gt;
could someone please help me out.I've sales data with variables Date of Sale, Number of units sold and the Laptop model ( there are two A and B ).I've three raw data files called :&lt;BR /&gt;
Period 1 sales , Period 2 Sales_A, Period 2 Sales_B.&lt;BR /&gt;
&lt;BR /&gt;
I used the following code to first obtain the raw data in proper format :&lt;BR /&gt;
&lt;BR /&gt;
libname sc 'h:\SAScourse';&lt;BR /&gt;
data Period1Sales;&lt;BR /&gt;
	infile  'h:\SAScourse\period1_sales_data.dat';&lt;BR /&gt;
	input  TransactionID        $1-8&lt;BR /&gt;
		 DateofSale	    $9-18&lt;BR /&gt;
		TimeofSale	    $19-26&lt;BR /&gt;
		LaptopModel	    $27-32&lt;BR /&gt;
		UnitsSold	    33-35&lt;BR /&gt;
		Warranty        36;&lt;BR /&gt;
proc print data = Period1Sales;&lt;BR /&gt;
TITLE 'period1_sales_data.dat';&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
data period2_sales_data_A;&lt;BR /&gt;
	infile 'h:\SAScourse\period2_sales_data_A.dat';&lt;BR /&gt;
	Input 	TransactionID $1-8&lt;BR /&gt;
			DateofSale	  $9-18&lt;BR /&gt;
			LaptopModel   $19-24&lt;BR /&gt;
			UnitsSold      25-27&lt;BR /&gt;
			Warranty       28;&lt;BR /&gt;
proc print data=period2_sales_data_A;&lt;BR /&gt;
TITLE 'period2_sales_data_A';&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
data period2_sales_data_B;&lt;BR /&gt;
infile 'h:\SAScourse\period2_sales_data_B.dat';&lt;BR /&gt;
Input      TransactionID   	 $1-8&lt;BR /&gt;
	     TimeofSale	        $9-16;&lt;BR /&gt;
			&lt;BR /&gt;
proc print data=period2_sales_data_B;&lt;BR /&gt;
TITLE 'period2_sales_data_B';&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
There was no problems with the first and third codes , but the 2nd code for the raw data file period2_sales_data_A is showing 0 obseravations selected . I get the varables but with no entries in them.&lt;BR /&gt;
&lt;BR /&gt;
Also , is there a way to combine/merge all three raw data files into one file to analyse the data.&lt;BR /&gt;
&lt;BR /&gt;
Regards ,&lt;BR /&gt;
mark</description>
      <pubDate>Sun, 14 Feb 2010 06:02:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57092#M15934</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-02-14T06:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Combining/Merging Three datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57093#M15935</link>
      <description>To diagnose your  input data problem, you may consider adding the SAS DATA step statement below to display to your SAS log:&lt;BR /&gt;
&lt;BR /&gt;
PUTLOG _ALL_;&lt;BR /&gt;
&lt;BR /&gt;
..or..&lt;BR /&gt;
&lt;BR /&gt;
PUTLOG _INFILE_;&lt;BR /&gt;
&lt;BR /&gt;
Also, to combine your SAS files for analysis, again, a DATA step approach using either a SET statement or depending on your needs, possibly a MERGE statement (with a companion BY statement) may be suitable.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Sun, 14 Feb 2010 07:05:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57093#M15935</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-02-14T07:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: Combining/Merging Three datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57094#M15936</link>
      <description>Hi Mark,&lt;BR /&gt;
&lt;BR /&gt;
Here you can check that the numeric values are at the right positions as you mentioned in the second code:&lt;BR /&gt;
UnitsSold 25-27&lt;BR /&gt;
Warranty 28&lt;BR /&gt;
Since other variables are character variables there will be no problem importing the file for them. But if you come across a character on the above mentioned positions, the values will not be taken, So you can check the period 2 file once again to check those positions. 25-27 &amp;amp; 28. If that is the case, then it would generate an error in the log and as Scott mentioned you need to go through the log for the same.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Saurabh.</description>
      <pubDate>Mon, 15 Feb 2010 06:14:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57094#M15936</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-02-15T06:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: Combining/Merging Three datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57095#M15937</link>
      <description>Hi Saurabh ,&lt;BR /&gt;
&lt;BR /&gt;
I'd really be much greatful if you could sugggest an appropriate code for this as i'm just a beginner in the SAS . I'd really appreciate that .&lt;BR /&gt;
&lt;BR /&gt;
Thanks and kind  reagards ,&lt;BR /&gt;
&lt;BR /&gt;
mark</description>
      <pubDate>Thu, 18 Feb 2010 01:19:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57095#M15937</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-02-18T01:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: Combining/Merging Three datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57096#M15938</link>
      <description>Hi Mark,&lt;BR /&gt;
&lt;BR /&gt;
Well as I had told that there might be a issue of different datatypes while creating the datasets.&lt;BR /&gt;
I can help you if you can post a sample data which you are working on.&lt;BR /&gt;
One thing which you can watch out for is that if your numeric data like Units sold contain commas(eg: 1,000) or a simple numeric value(1000).&lt;BR /&gt;
If it contains comma then try importing it with a informat comma. else it will contradict with the simple numeric format and will try to import it as character value, which would give an error.&lt;BR /&gt;
&lt;BR /&gt;
If you still find problems then request you to post a sample data which can give us some insight on why you might be facing the problem.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Saurabh.</description>
      <pubDate>Thu, 18 Feb 2010 06:15:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57096#M15938</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-02-18T06:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Combining/Merging Three datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57097#M15939</link>
      <description>Hello Saurabh ,&lt;BR /&gt;
&lt;BR /&gt;
I couldnt find a link to attach the sample data.Could you please suggest&lt;BR /&gt;
&lt;BR /&gt;
Kind  regards ,&lt;BR /&gt;
mark &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Hi Mark,&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Well as I had told that there might be a issue of&lt;BR /&gt;
&amp;gt; different datatypes while creating the datasets.&lt;BR /&gt;
&amp;gt; I can help you if you can post a sample data which&lt;BR /&gt;
&amp;gt; you are working on.&lt;BR /&gt;
&amp;gt; One thing which you can watch out for is that if your&lt;BR /&gt;
&amp;gt; numeric data like Units sold contain commas(eg:&lt;BR /&gt;
&amp;gt; 1,000) or a simple numeric value(1000).&lt;BR /&gt;
&amp;gt; If it contains comma then try importing it with a&lt;BR /&gt;
&amp;gt; informat comma. else it will contradict with the&lt;BR /&gt;
&amp;gt; simple numeric format and will try to import it as&lt;BR /&gt;
&amp;gt; character value, which would give an error.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; If you still find problems then request you to post a&lt;BR /&gt;
&amp;gt; sample data which can give us some insight on why you&lt;BR /&gt;
&amp;gt; might be facing the problem.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Thanks,&lt;BR /&gt;
&amp;gt; Saurabh.</description>
      <pubDate>Thu, 18 Feb 2010 10:46:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57097#M15939</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-02-18T10:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: Combining/Merging Three datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57098#M15940</link>
      <description>Hello Saurabh ,&lt;BR /&gt;
&lt;BR /&gt;
The data is as follows :&lt;BR /&gt;
&lt;BR /&gt;
Period 2A ( first  week ) , Period2B ( second week ) for the period 15/11/2009 – 28/11/2009 :&lt;BR /&gt;
&lt;BR /&gt;
Period 2A&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
        		 Transaction                    Laptop    Units&lt;BR /&gt;
                   Obs        ID         DateofSale    Model      Sold    Warranty&lt;BR /&gt;
&lt;BR /&gt;
                     1     RX000309      15/11/2009    AP3965      1          0&lt;BR /&gt;
                     2     RX000310      15/11/2009    AP3965      1          0&lt;BR /&gt;
                     3     RX000311      15/11/2009    AP3965      1          0&lt;BR /&gt;
                     4     RX000312      15/11/2009    AP3965      1          0&lt;BR /&gt;
                     5     RX000314      15/11/2009    AP3965      1          0&lt;BR /&gt;
                     6     RX000317      15/11/2009    AP3965      1          0&lt;BR /&gt;
                     7     RX000318      15/11/2009    AP3965      1          0&lt;BR /&gt;
                     8     RX000319      15/11/2009    AP3965      1          0&lt;BR /&gt;
                     9     RX000320      15/11/2009    AP3965      1          0&lt;BR /&gt;
                    10     RX000326      15/11/2009    AT3600      1          0&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
			Period 2B&lt;BR /&gt;
&lt;BR /&gt;
               			      Transaction     Timeof&lt;BR /&gt;
                                    Obs        ID           Sale&lt;BR /&gt;
&lt;BR /&gt;
                                      1     RX000551      18:21:58&lt;BR /&gt;
                                      2     RX000550      14:01:20&lt;BR /&gt;
                                      3     RX000549      14:38:43&lt;BR /&gt;
                                      4     RX000548      09:39:52&lt;BR /&gt;
                                      5     RX000547      11:30:21&lt;BR /&gt;
                                      6     RX000546      11:31:28&lt;BR /&gt;
                                      7     RX000545      10:21:58&lt;BR /&gt;
                                      8     RX000544      10:34:57&lt;BR /&gt;
                                      9     RX000543      04:00:04&lt;BR /&gt;
                                     10     RX000542      10:14:31</description>
      <pubDate>Thu, 18 Feb 2010 11:18:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57098#M15940</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-02-18T11:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: Combining/Merging Three datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57099#M15941</link>
      <description>Hi Mark,&lt;BR /&gt;
&lt;BR /&gt;
If the problem still persists,&lt;BR /&gt;
I would like to tell you that the positions which you are using in the code are not correct :&lt;BR /&gt;
TransactionID $1-8&lt;BR /&gt;
DateofSale $9-18&lt;BR /&gt;
LaptopModel $19-24&lt;BR /&gt;
UnitsSold 25-27&lt;BR /&gt;
Warranty 28;&lt;BR /&gt;
&lt;BR /&gt;
As per the data, count spaces also as a part which constitutes one position.&lt;BR /&gt;
&lt;BR /&gt;
then retry using the updated positions.&lt;BR /&gt;
Example: 1-8 is a transaction id.&lt;BR /&gt;
then 9th position is a space in the data and not the starting of the date value. so you face this problem.&lt;BR /&gt;
date starts from 10th position.&lt;BR /&gt;
&lt;BR /&gt;
I hope this would clear the doubt, and will help you solve the problem.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Saurabh.</description>
      <pubDate>Tue, 23 Feb 2010 06:43:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combining-Merging-Three-datasets/m-p/57099#M15941</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-02-23T06:43:44Z</dc:date>
    </item>
  </channel>
</rss>

