<?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: I want  empty dataset  to be worked in Proc means. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/I-want-empty-dataset-to-be-worked-in-Proc-means/m-p/72364#M15604</link>
    <description>Your post appears to ask about how to generate observations in your output file, WORK.FLEXDATA, using PROC MEANS, however your input file, WORK.FLEX, happens to be empty.&lt;BR /&gt;
&lt;BR /&gt;
How should PROC MEANS treat this condition and what would you expect to see generated in your output file?  Maybe you can show an input and output (expected) file content?&lt;BR /&gt;
&lt;BR /&gt;
By the way, I ran similar code with an empty input file and PROC MEANS does generate an empty output file.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
data flex;&lt;BR /&gt;
retain rptseg . region ' ';&lt;BR /&gt;
retain osbal limit countcust lno 0;&lt;BR /&gt;
stop;&lt;BR /&gt;
run;&lt;BR /&gt;
PROC MEANS DATA=FLEX COMPLETETYPES NOPRINT;&lt;BR /&gt;
CLASS RPTSEG REGION / PRELOADFMT;&lt;BR /&gt;
VAR OSBAL LIMIT COUNTCUST LNO;&lt;BR /&gt;
TYPES RPTSEG * REGION;&lt;BR /&gt;
* FORMAT RPTSEG MKTSEG. REGION $REGION.;&lt;BR /&gt;
OUTPUT OUT=FLEXDATA SUM= N= /AUTONAME;&lt;BR /&gt;
run;</description>
    <pubDate>Wed, 04 Feb 2009 00:13:06 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2009-02-04T00:13:06Z</dc:date>
    <item>
      <title>I want  empty dataset  to be worked in Proc means.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-empty-dataset-to-be-worked-in-Proc-means/m-p/72363#M15603</link>
      <description>Hi Dear,&lt;BR /&gt;
         Here is my coding. I  want all possible combinations of the following class variables REPSEG AND REGION using Proc means. The following code work fine.But when  the input dataset empty, I need zeros in OSBAL LIMIT COUNTCUST AND LNO with the all the possilbe combinaion of Class variable.&lt;BR /&gt;
&lt;BR /&gt;
PROC  MEANS DATA=FLEX COMPLETETYPES  NOPRINT;&lt;BR /&gt;
CLASS RPTSEG  REGION /  PRELOADFMT;&lt;BR /&gt;
VAR OSBAL LIMIT COUNTCUST LNO;&lt;BR /&gt;
TYPES RPTSEG * REGION;&lt;BR /&gt;
FORMAT RPTSEG MKTSEG. REGION $REGION.;&lt;BR /&gt;
OUTPUT OUT=FLEXDATA SUM= N= /AUTONAME;&lt;BR /&gt;
&lt;BR /&gt;
Can any one advice any solution for my question.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
thanks very much in advance for your help.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Inp</description>
      <pubDate>Tue, 03 Feb 2009 22:01:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-empty-dataset-to-be-worked-in-Proc-means/m-p/72363#M15603</guid>
      <dc:creator>Inp</dc:creator>
      <dc:date>2009-02-03T22:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: I want  empty dataset  to be worked in Proc means.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-empty-dataset-to-be-worked-in-Proc-means/m-p/72364#M15604</link>
      <description>Your post appears to ask about how to generate observations in your output file, WORK.FLEXDATA, using PROC MEANS, however your input file, WORK.FLEX, happens to be empty.&lt;BR /&gt;
&lt;BR /&gt;
How should PROC MEANS treat this condition and what would you expect to see generated in your output file?  Maybe you can show an input and output (expected) file content?&lt;BR /&gt;
&lt;BR /&gt;
By the way, I ran similar code with an empty input file and PROC MEANS does generate an empty output file.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
data flex;&lt;BR /&gt;
retain rptseg . region ' ';&lt;BR /&gt;
retain osbal limit countcust lno 0;&lt;BR /&gt;
stop;&lt;BR /&gt;
run;&lt;BR /&gt;
PROC MEANS DATA=FLEX COMPLETETYPES NOPRINT;&lt;BR /&gt;
CLASS RPTSEG REGION / PRELOADFMT;&lt;BR /&gt;
VAR OSBAL LIMIT COUNTCUST LNO;&lt;BR /&gt;
TYPES RPTSEG * REGION;&lt;BR /&gt;
* FORMAT RPTSEG MKTSEG. REGION $REGION.;&lt;BR /&gt;
OUTPUT OUT=FLEXDATA SUM= N= /AUTONAME;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 04 Feb 2009 00:13:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-empty-dataset-to-be-worked-in-Proc-means/m-p/72364#M15604</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-02-04T00:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: I want  empty dataset  to be worked in Proc means.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-empty-dataset-to-be-worked-in-Proc-means/m-p/72365#M15605</link>
      <description>Thanks Scott for your reponse. &lt;BR /&gt;
But I am looking for non empty output  dataset from proc means for the input empty dataset.&lt;BR /&gt;
&lt;BR /&gt;
Here is my format for the class variable.&lt;BR /&gt;
proc format&lt;BR /&gt;
   VALUE $REGION&lt;BR /&gt;
   'A','B','C','E' = 'ATLANTIC REGION'&lt;BR /&gt;
       'G','J','H' = 'QUEBEC REGION'&lt;BR /&gt;
   OTHER = 'REGION ERROR'&lt;BR /&gt;
   ;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
PROC FORMAT;&lt;BR /&gt;
VALUE MKTSEG&lt;BR /&gt;
1='COMMERICAL '&lt;BR /&gt;
2='SMALL BUSINESS'&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
My expected resulst for the empy data set is as follows. All values are not alligned here; I tried my best to make allign. Since I put completetypes and PRELOADFMT. I expect, for any empyt dataset,  the proc means to produce all possible values of class variables according to my format and the related var values to be zero  or missing .&lt;BR /&gt;
&lt;BR /&gt;
My target to produce a report either the dataset is empty or non empty. For non empty dataset it is working fine. &lt;BR /&gt;
For empty dataset, I want to produce a report for my customer,  for the following  Business type and the region,  the values(var ) are zero.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the help again&lt;BR /&gt;
&lt;BR /&gt;
Inp&lt;BR /&gt;
&lt;BR /&gt;
  &lt;BR /&gt;
                                     OSBAL_ LIMIT_COUNTCUST_  LOANNO_                    &lt;BR /&gt;
OBS      RPTSEG      REGION           Sum   Sum   Sum         Sum    OSBAL_N  LIMIT_N   N    LNO_N&lt;BR /&gt;
&lt;BR /&gt;
 1   COMMERICAL      ATLANTIC REGION   .     .    .            .        0        0      0      0&lt;BR /&gt;
 2   COMMERICAL      QUEBEC REGION     .     .    .            .        0        0      0      0&lt;BR /&gt;
 3   COMMERICAL      REGION ERROR      .     .    .            .        0        0      0      0&lt;BR /&gt;
 4   SMALL BUSINESS  ATLANTIC REGION   .     .    .            .        0        0      0      0&lt;BR /&gt;
 5   SMALL BUSINESS  QUEBEC REGION     .     .    .            .        0        0      0      0&lt;BR /&gt;
 6   SMALL BUSINESS  REGION ERROR      .     .    .            .        0        0      0      0</description>
      <pubDate>Wed, 04 Feb 2009 16:08:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-empty-dataset-to-be-worked-in-Proc-means/m-p/72365#M15605</guid>
      <dc:creator>Inp</dc:creator>
      <dc:date>2009-02-04T16:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: I want  empty dataset  to be worked in Proc means.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-empty-dataset-to-be-worked-in-Proc-means/m-p/72366#M15606</link>
      <description>It seems you are trying to get missing to equal zero.  They are not the same thing.  Proc Means could not produce zeros as that would not be correct.  &lt;BR /&gt;
&lt;BR /&gt;
Try checking if your  input is empty, then setting zeros as input to proc means.  Then the result would be zero.</description>
      <pubDate>Wed, 04 Feb 2009 16:51:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-empty-dataset-to-be-worked-in-Proc-means/m-p/72366#M15606</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-02-04T16:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: I want  empty dataset  to be worked in Proc means.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-empty-dataset-to-be-worked-in-Proc-means/m-p/72367#M15607</link>
      <description>You may add a data step view to append one missing record if the data set is empty. The view is just identical to the data set if not empty. I assumed same data structure regardless of emptyness. It works only because one of your formats doesn't cover the missing value.&lt;BR /&gt;
/*&lt;BR /&gt;
data flex;&lt;BR /&gt;
	format rptseg mktseg. region $region.;&lt;BR /&gt;
	length osbal limit countcust lno 8;&lt;BR /&gt;
	stop;&lt;BR /&gt;
run;&lt;BR /&gt;
data flex1 / view=flex1;&lt;BR /&gt;
	if _n_=1 then if 0 then set flex nobs=nobs;&lt;BR /&gt;
	if nobs&amp;gt;0 then set flex ;&lt;BR /&gt;
run;&lt;BR /&gt;
PROC MEANS DATA=FLEX1 COMPLETETYPES NOPRINT;&lt;BR /&gt;
CLASS RPTSEG REGION / PRELOADFMT;&lt;BR /&gt;
VAR OSBAL LIMIT COUNTCUST LNO;&lt;BR /&gt;
TYPES RPTSEG * REGION;&lt;BR /&gt;
FORMAT RPTSEG MKTSEG. REGION $REGION.;&lt;BR /&gt;
OUTPUT OUT=FLEXDATA SUM= N= /AUTONAME;&lt;BR /&gt;
RUN;&lt;BR /&gt;
*/</description>
      <pubDate>Wed, 04 Feb 2009 16:56:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-empty-dataset-to-be-worked-in-Proc-means/m-p/72367#M15607</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-02-04T16:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: I want  empty dataset  to be worked in Proc means.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-empty-dataset-to-be-worked-in-Proc-means/m-p/72368#M15608</link>
      <description>Thanks so much Urchin,. Your are the man.&lt;BR /&gt;
It worked perfectly what I want. I put the follow codes and removed  the view.&lt;BR /&gt;
&lt;BR /&gt;
data flex;&lt;BR /&gt;
if _n_=1 then if 0 then set flex nobs=nobs;&lt;BR /&gt;
if nobs&amp;gt;0 then set flex ;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Thanks to Flip and Scott for sharing your knowledge.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
thanks&lt;BR /&gt;
&lt;BR /&gt;
Inp</description>
      <pubDate>Wed, 04 Feb 2009 17:20:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-empty-dataset-to-be-worked-in-Proc-means/m-p/72368#M15608</guid>
      <dc:creator>Inp</dc:creator>
      <dc:date>2009-02-04T17:20:12Z</dc:date>
    </item>
  </channel>
</rss>

