<?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: Data Set Qustions in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Data-Set-Qustions/m-p/75119#M21776</link>
    <description>I recommend that you also do some research in the documentation (sum statement) so that you'll understand how this works.&lt;BR /&gt;
&lt;BR /&gt;
data Columnwisesum;                                                                                                                     &lt;BR /&gt;
input num1;                                                                                                                             &lt;BR /&gt;
totl+num1;                                                                                                                              &lt;BR /&gt;
Datalines;                                                                                                                              &lt;BR /&gt;
100                                                                                                                                     &lt;BR /&gt;
200                                                                                                                                     &lt;BR /&gt;
300                                                                                                                                     &lt;BR /&gt;
400                                                                                                                                     &lt;BR /&gt;
500                                                                                                                                     &lt;BR /&gt;
600                                                                                                                                     &lt;BR /&gt;
;                                                                                                                                       &lt;BR /&gt;
run;</description>
    <pubDate>Tue, 13 Apr 2010 17:36:44 GMT</pubDate>
    <dc:creator>Bill</dc:creator>
    <dc:date>2010-04-13T17:36:44Z</dc:date>
    <item>
      <title>Data Set Qustions</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-Set-Qustions/m-p/75117#M21774</link>
      <description>How to calculate Column wise sum in DATA STATEMENT?&lt;BR /&gt;
&lt;BR /&gt;
	ex: data set&lt;BR /&gt;
		data Columnwisesum;&lt;BR /&gt;
		 input num1;&lt;BR /&gt;
		    Datalines;&lt;BR /&gt;
		      100 &lt;BR /&gt;
		      200 &lt;BR /&gt;
		      300 &lt;BR /&gt;
		      400 &lt;BR /&gt;
 		      500 &lt;BR /&gt;
		      600 &lt;BR /&gt;
		    ;&lt;BR /&gt;
	   run;&lt;B&gt;&lt;/B&gt;</description>
      <pubDate>Tue, 13 Apr 2010 16:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-Set-Qustions/m-p/75117#M21774</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-04-13T16:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Data Set Qustions</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-Set-Qustions/m-p/75118#M21775</link>
      <description>Hi:&lt;BR /&gt;
  The DATA statement is what starts your DATA step program ... this is the program where you are reading values for NUM1 into a SAS dataset.&lt;BR /&gt;
 &lt;BR /&gt;
  You can't calculate the SUM of the NUM1 variable in a DATA &lt;B&gt;statement&lt;/B&gt;. However, within a DATA step &lt;B&gt;program&lt;/B&gt;, you can create a new variable to hold the total of the sum of the NUM1 values on every observation.&lt;BR /&gt;
 &lt;BR /&gt;
  However, I wonder why you want to calculate the total of NUM1 in a DATA step program. Do you need a REPORT that shows the summary of all the NUM1 values??? You could do this with PROC PRINT, without creating any new variables in the dataset. (Or you could use any number of other procedures.)&lt;BR /&gt;
 &lt;BR /&gt;
  If you do need to calculate the sum of NUM1 in the DATA step program, then you would need to create a new variable with an assignment statement. Possibly you would use a RETAIN statement so that you could retain the value of your total-holding variable from observation to observation. Then you have to decide how you want to deal with the total at the end of the input file -- what do you envision seeing in the output dataset??? You don't have any other identifying variables (like a category variable or name, etc), so how would you distinguish the total of 2100 from the "regular" observation lines?? This is what leads me to wonder whether you really just want a report with a summary line versus calculating the total of NUM1 in a DATA step program.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 13 Apr 2010 17:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-Set-Qustions/m-p/75118#M21775</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-04-13T17:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Data Set Qustions</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-Set-Qustions/m-p/75119#M21776</link>
      <description>I recommend that you also do some research in the documentation (sum statement) so that you'll understand how this works.&lt;BR /&gt;
&lt;BR /&gt;
data Columnwisesum;                                                                                                                     &lt;BR /&gt;
input num1;                                                                                                                             &lt;BR /&gt;
totl+num1;                                                                                                                              &lt;BR /&gt;
Datalines;                                                                                                                              &lt;BR /&gt;
100                                                                                                                                     &lt;BR /&gt;
200                                                                                                                                     &lt;BR /&gt;
300                                                                                                                                     &lt;BR /&gt;
400                                                                                                                                     &lt;BR /&gt;
500                                                                                                                                     &lt;BR /&gt;
600                                                                                                                                     &lt;BR /&gt;
;                                                                                                                                       &lt;BR /&gt;
run;</description>
      <pubDate>Tue, 13 Apr 2010 17:36:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-Set-Qustions/m-p/75119#M21776</guid>
      <dc:creator>Bill</dc:creator>
      <dc:date>2010-04-13T17:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: Data Set Qustions</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-Set-Qustions/m-p/75120#M21777</link>
      <description>And I wonder whether this is more what is desired as the possible outcome, which doesn't require using the SUM statement and the implied RETAIN.&lt;BR /&gt;
&lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc print data=columnwisesum label;&lt;BR /&gt;
  title '1a) Use SUM statement with PROC PRINT -- do not need to calc sum in DATA step';&lt;BR /&gt;
  sum num1;&lt;BR /&gt;
  var num1;&lt;BR /&gt;
  label num1 = 'NUM1';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 13 Apr 2010 17:49:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-Set-Qustions/m-p/75120#M21777</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-04-13T17:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Data Set Qustions</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-Set-Qustions/m-p/75121#M21778</link>
      <description>Hi Cynthia&lt;BR /&gt;
&lt;BR /&gt;
Thank you for your solution, &lt;BR /&gt;
this is asked me in the interview, i defend the answer as you explain me in the above, but the interviewer except from me as follows  &lt;BR /&gt;
                                            Obs    NUM1&lt;BR /&gt;
                                             1      100&lt;BR /&gt;
                                             2      200&lt;BR /&gt;
                                             3      300&lt;BR /&gt;
                                             4      400&lt;BR /&gt;
                                             5      500&lt;BR /&gt;
                                             6      600&lt;BR /&gt;
                                                   ====&lt;BR /&gt;
                                                   2100&lt;BR /&gt;
by using DATA Statement, &lt;BR /&gt;
so that i posted this question to get the answer,  is there any way to find&lt;BR /&gt;
thanks&lt;BR /&gt;
Patil MG</description>
      <pubDate>Wed, 14 Apr 2010 05:21:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-Set-Qustions/m-p/75121#M21778</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-04-14T05:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: Data Set Qustions</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-Set-Qustions/m-p/75122#M21779</link>
      <description>Hi Cynthia, &lt;BR /&gt;
&lt;BR /&gt;
I am giving BASE SAS certification, If you have information, could you please let me know  what are changes happen in SAS 9.2, what i need to cover in SAS 9.2 before taking certification, if you have pattern and sample questions on BASE SAS please post me. &lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Patil MG</description>
      <pubDate>Wed, 14 Apr 2010 05:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-Set-Qustions/m-p/75122#M21779</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-04-14T05:26:04Z</dc:date>
    </item>
  </channel>
</rss>

