<?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: How to create dummy data for reporting in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dummy-data-for-reporting/m-p/238954#M43926</link>
    <description>&lt;P&gt;As others have mentioned, it would be a lot easier if you provided some example data and what you are looking the output to be.&amp;nbsp; Just guessing here and thinking what I would do to search for a variable within a data set, I came up with the following.&amp;nbsp; Not sure if this is what you're looking for or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
input ID$ Value;
datalines;
1 100
2 200
;
run;

data have2;
input ID$;
datalines;
1
2
;
run;

options mprint symbolgen mlogic;
%macro missing(lib,data,var);
proc sql noprint;
select name into: Variables separated by ","
from sashelp.vcolumn
where libname="&amp;amp;lib" AND memname="&amp;amp;data";
quit;

data _NULL_;
check=find("&amp;amp;Variables","&amp;amp;var");
call symput("check",check);
run;

%if &amp;amp;check=0 %then %do;
	data &amp;amp;lib..&amp;amp;data;
	set &amp;amp;lib..&amp;amp;data;
	&amp;amp;var=0;
	run;
%end;
%mend;

%missing(WORK,HAVE1,Value)
%missing(WORK,HAVE2,Value);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 11 Dec 2015 18:37:22 GMT</pubDate>
    <dc:creator>dcruik</dc:creator>
    <dc:date>2015-12-11T18:37:22Z</dc:date>
    <item>
      <title>How to create dummy data for reporting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dummy-data-for-reporting/m-p/238905#M43911</link>
      <description>&lt;P&gt;I want to create a line which should say if i do not have a record named 'Missing variable ' i need to create it and assign values as 0 and if present leave as it is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone help me in this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2015 15:05:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dummy-data-for-reporting/m-p/238905#M43911</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2015-12-11T15:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dummy data for reporting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dummy-data-for-reporting/m-p/238907#M43913</link>
      <description>&lt;P&gt;Without more specific information, its impossible to give you the exact code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, the steps would be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Search for record named "missing variable"&lt;/LI&gt;
&lt;LI&gt;If not found, create the record with values of 0&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Fri, 11 Dec 2015 15:10:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dummy-data-for-reporting/m-p/238907#M43913</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-12-11T15:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dummy data for reporting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dummy-data-for-reporting/m-p/238933#M43923</link>
      <description>&lt;P&gt;Give an example of the data you have and what you want.&amp;nbsp; I'm having trouble imagining:&amp;nbsp; looking for 'missing variable' and adding record with value of 0.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2015 16:32:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dummy-data-for-reporting/m-p/238933#M43923</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-12-11T16:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dummy data for reporting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dummy-data-for-reporting/m-p/238954#M43926</link>
      <description>&lt;P&gt;As others have mentioned, it would be a lot easier if you provided some example data and what you are looking the output to be.&amp;nbsp; Just guessing here and thinking what I would do to search for a variable within a data set, I came up with the following.&amp;nbsp; Not sure if this is what you're looking for or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
input ID$ Value;
datalines;
1 100
2 200
;
run;

data have2;
input ID$;
datalines;
1
2
;
run;

options mprint symbolgen mlogic;
%macro missing(lib,data,var);
proc sql noprint;
select name into: Variables separated by ","
from sashelp.vcolumn
where libname="&amp;amp;lib" AND memname="&amp;amp;data";
quit;

data _NULL_;
check=find("&amp;amp;Variables","&amp;amp;var");
call symput("check",check);
run;

%if &amp;amp;check=0 %then %do;
	data &amp;amp;lib..&amp;amp;data;
	set &amp;amp;lib..&amp;amp;data;
	&amp;amp;var=0;
	run;
%end;
%mend;

%missing(WORK,HAVE1,Value)
%missing(WORK,HAVE2,Value);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Dec 2015 18:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dummy-data-for-reporting/m-p/238954#M43926</guid>
      <dc:creator>dcruik</dc:creator>
      <dc:date>2015-12-11T18:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dummy data for reporting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-dummy-data-for-reporting/m-p/238972#M43929</link>
      <description>&lt;P&gt;I am not familiar with the concept of a "record name" either, but as people have already started guessing, I would like to suggest the following as a draft&amp;nbsp;you could start with (under certain assumptions):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
length record_name $20;
input record_name a b c;
cards;
abc    3 1 4
defghi 1 5 9
jklm   2 6 5
;

data want;
set have end=last;
array numvar[*] a--c; /* replace a--c by the list of variables you want to set to zero */
output;
missvarflag+(record_name='Missing variable'); /* replace "record_name=..." by your criterion for a record named ... */
if last &amp;amp; ~missvarflag then do;
  record_name='Missing variable'; /* see above */
  do _n_=1 to dim(numvar);
    numvar[_n_]=0;
  end;
  output;
end;
drop missvarflag;
run; 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2015 19:30:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-dummy-data-for-reporting/m-p/238972#M43929</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2015-12-11T19:30:41Z</dc:date>
    </item>
  </channel>
</rss>

