<?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 over many years in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604257#M175162</link>
    <description>&lt;P&gt;YOu want to do the same table for the 13 successive years 2005 through 2017.&amp;nbsp; And, luckily the datasets are named DRG_2005, DRG_2006, ... DRG_2017.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can make a data set from all 13 successive years, and do a single proc FREQ with a BY statement telling SAS to do the table for each of the 13 consecutive by-levels.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did I say "make a data set"?&amp;nbsp; Yes, but you don't have to worry about excessive disk space use or input/output actrivity, because you can make a data set VIEW, not a data set FILE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data need /view=need;
   set mylib.DRG_20:   indsname=indsn;
   dsname=indsn;
run;

proc freq data=need;
  by dsname;
  tables ..... ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;OL&gt;
&lt;LI&gt;The SET statement does this:
&lt;OL&gt;
&lt;LI&gt;Reads in all the datasets in libname mylib, whose data set name begins with DRG_20.&amp;nbsp; Those data sets are read in lexicographic order (i.e. DRG_2005, DRG_2006, ... DRG_2017).&lt;/LI&gt;
&lt;LI&gt;The "indsname=" option stores the name of the data set for each incoming observation into temporary variable INDSN.&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;LI&gt;So the dataset name is saved in permament variable DSNAME.&lt;/LI&gt;
&lt;LI&gt;The view is just a definition.&amp;nbsp; It is not actuated until the view is named in a later proc.&amp;nbsp; (i.e. the "data=need" in the proc freq statement).&amp;nbsp; So the data are read in from each and every original data set into the proc freq.&amp;nbsp; No muss, no fuss.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Nov 2019 20:03:14 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2019-11-14T20:03:14Z</dc:date>
    <item>
      <title>Data over many years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604246#M175152</link>
      <description>&lt;P&gt;Hey guys,&lt;/P&gt;&lt;P&gt;so I have Data from year 2005, 2006, 2007, ... up to 2017, called "drg2005_sf" and so on.&lt;/P&gt;&lt;P&gt;And I want my tables (for example how many males and famles are there this year), for each year in the same way. But I want to have 8 single tables in the end so I see how many males/females I have in 2005, how many in 2006, ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I have is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro muster;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let startjahr = 2005;&lt;BR /&gt;%let endejahr = 2017;&lt;BR /&gt;%do year = &amp;amp;startjahr %to &amp;amp;endejahr;&lt;/P&gt;&lt;P&gt;data drg_&amp;amp;year;&lt;BR /&gt;set daten.&amp;amp;datenname.&amp;amp;year._sf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data drg;&lt;BR /&gt;set drg_&amp;amp;year&lt;BR /&gt;%if &amp;amp;year &amp;gt; &amp;amp;startjahr %then %do;&lt;BR /&gt;drg&lt;BR /&gt;%end;&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%mend muster;&lt;/P&gt;&lt;P&gt;%muster&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Down below I got:&lt;/P&gt;&lt;P&gt;proc freq data = drg;&lt;BR /&gt;title "Output Nr. 1 male/female";&lt;BR /&gt;table XX;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my work libary I get 8 outfiles, but the result from my "proc freq data" is all males/females added up 2005 + 2006 ,... and not seperated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope you get my problem and may help me, thanks a lot!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 18:44:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604246#M175152</guid>
      <dc:creator>hannah_hortlik</dc:creator>
      <dc:date>2019-11-14T18:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Data over many years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604250#M175156</link>
      <description>&lt;P&gt;Here's an example to do what I think you're aiming to do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	set sashelp.class;
	birth_year=2019-age;
run;

proc sql;
create table years as
select distinct birth_year from have &lt;BR /&gt;order by birth_year;
quit;

data _null_;
set years;
call execute(cats(
	'data prefix_',birth_year,';
		set have(where=(birth_year=',birth_year,'));
	 run;'
	));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;-unison&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 19:01:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604250#M175156</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2019-11-14T19:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: Data over many years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604252#M175158</link>
      <description>&lt;P&gt;I don't quite get what your macro code is doing and likely mostly unneeded.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will find that in most cases you would be better off using names like DRG_sf_2005 instead of drg2005_sf. That would allow combining the data with code like:&lt;/P&gt;
&lt;PRE&gt;data drg;
   set drg_sf_2005 - drg_sf_2017;
run;&lt;/PRE&gt;
&lt;P&gt;If you don't have any other sets that start with drg2005 you may also be able to use:&lt;/P&gt;
&lt;PRE&gt;data drg;
   set drg2005: - drg2017: ;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have a variable in your data set indicating which year it is from? If not then add one and you would get separate tables for each year by&lt;/P&gt;
&lt;PRE&gt;Proc sort data=drg;
   by year;
run;


proc freq data = drg;
title "Output Nr. 1 male/female";
by year;
table XX;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 19:03:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604252#M175158</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-14T19:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Data over many years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604257#M175162</link>
      <description>&lt;P&gt;YOu want to do the same table for the 13 successive years 2005 through 2017.&amp;nbsp; And, luckily the datasets are named DRG_2005, DRG_2006, ... DRG_2017.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can make a data set from all 13 successive years, and do a single proc FREQ with a BY statement telling SAS to do the table for each of the 13 consecutive by-levels.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did I say "make a data set"?&amp;nbsp; Yes, but you don't have to worry about excessive disk space use or input/output actrivity, because you can make a data set VIEW, not a data set FILE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data need /view=need;
   set mylib.DRG_20:   indsname=indsn;
   dsname=indsn;
run;

proc freq data=need;
  by dsname;
  tables ..... ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;OL&gt;
&lt;LI&gt;The SET statement does this:
&lt;OL&gt;
&lt;LI&gt;Reads in all the datasets in libname mylib, whose data set name begins with DRG_20.&amp;nbsp; Those data sets are read in lexicographic order (i.e. DRG_2005, DRG_2006, ... DRG_2017).&lt;/LI&gt;
&lt;LI&gt;The "indsname=" option stores the name of the data set for each incoming observation into temporary variable INDSN.&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;LI&gt;So the dataset name is saved in permament variable DSNAME.&lt;/LI&gt;
&lt;LI&gt;The view is just a definition.&amp;nbsp; It is not actuated until the view is named in a later proc.&amp;nbsp; (i.e. the "data=need" in the proc freq statement).&amp;nbsp; So the data are read in from each and every original data set into the proc freq.&amp;nbsp; No muss, no fuss.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 20:03:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604257#M175162</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2019-11-14T20:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: Data over many years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604828#M175394</link>
      <description>&lt;P&gt;Thanks everyone for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data set list (WORK.DRG_20:) does not contain any members&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The Error is always this - SAS can't find my data.&lt;/P&gt;&lt;P&gt;So the rest afterwards doesn't work either.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But thank you for the explanation of your Codes, it really helps. But I don't know what's the problem now. And are the ":" always that the rest of the name doesn't matter? Like in my case, it's the beginning DRG_20 and whatever comes after will be worked with?&lt;/P&gt;</description>
      <pubDate>Sun, 17 Nov 2019 18:28:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604828#M175394</guid>
      <dc:creator>hannah_hortlik</dc:creator>
      <dc:date>2019-11-17T18:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: Data over many years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604830#M175396</link>
      <description>&lt;P&gt;Thank you, too!&lt;/P&gt;&lt;P&gt;Here is the same problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data drg;&lt;BR /&gt;set drg2005: - drg2017:&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the Error:&lt;/P&gt;&lt;P&gt;The data set list (WORK.drg2005:) does not contain any members&lt;/P&gt;&lt;P&gt;The data set list (WORK.drg2017:) does not contain any members&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so it does not count up from 2005, 2006, ... to 2017, and it doesn't get my data.&lt;/P&gt;&lt;P&gt;And no, I don't have a variable in your data set indicating which year it is from, and unfortunately I cannot add one because the data itself has to be unchanged .&lt;/P&gt;</description>
      <pubDate>Sun, 17 Nov 2019 18:36:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604830#M175396</guid>
      <dc:creator>hannah_hortlik</dc:creator>
      <dc:date>2019-11-17T18:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: Data over many years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604847#M175406</link>
      <description>&lt;P&gt;Hi Hannah,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try running this (an amendment to my code above). I think you can adapt it to directly work with your problem.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*sets a prefix for your tables;
%let pfx = drg_tbls;

/*Combine your source tables -- if you have a table that is all of these combined, use that. 
(here, I'm assuming data_year is a variable in each set 
otherwise I'd write a line to create that variable.)*/
data have;
	set sasuser.drg20: ;
run;

*get distinct data_years from your have source dataset - store in dataset called years;
proc sql;
create table years as
select distinct data_year from have order by data_year;
quit;

*loop through 'years' dataset and for each data_year, call excute code that has the template form:;
/* 	data &amp;amp;pfx._data_year; */
/* 		set have(where=(data_year=data_year)); */
/* 	 run; */

data _null_;
set years;
call execute(cats(
	"data &amp;amp;pfx._",data_year,';
		set have(where=(data_year=',data_year,'));
	 run;'
	));
run;

*Just a check to see what data is in work library;
proc datasets lib=work memtype=data;
run;

*Combines all datasets in work with the prefix you chose. -- sets dsname to the dataset name.;
data combine;
set &amp;amp;pfx.: indsname=dataset;
dsname=dataset;
run;

*Execute proc freq on combine show tables by dsname and sex.;
proc freq 
	data=combine; 
	tables dsname*sex; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It might help to use proc datasets to see what's in the WORK library.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-unison&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 15:16:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604847#M175406</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2019-11-18T15:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: Data over many years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604898#M175429</link>
      <description>&lt;P&gt;Hey, thank you.&lt;/P&gt;&lt;P&gt;Because I don't know what every step in your code means, I don't know exactly what to change for my specific data names etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I used:&lt;/P&gt;&lt;P&gt;data drg;&lt;BR /&gt;set sasuser.drg20:;&lt;BR /&gt;data_year=2005+1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table years as&lt;BR /&gt;select distinct data_year from have order by data_year;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;set years;&lt;BR /&gt;call execute(cats(&lt;BR /&gt;"data &amp;amp;pfx._",data_year,';&lt;BR /&gt;set have(where=(data_year=',data_year,'));&lt;BR /&gt;run;'&lt;BR /&gt;));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc datasets lib=work memtype=data;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data combine;&lt;BR /&gt;set &amp;amp;pfx.: indsname=dataset;&lt;BR /&gt;dsname=dataset;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc freq&lt;BR /&gt;data=combine;&lt;BR /&gt;tables dsname*sex;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As output I get:&lt;/P&gt;&lt;P&gt;work.drg&lt;/P&gt;&lt;P&gt;work.combine&lt;/P&gt;&lt;P&gt;work.years&lt;/P&gt;&lt;P&gt;work.praefix2006&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But in my work.drg table there are not all variables, so in the steps below sas always says "Variable xy is not in work.drg"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't get why it is so difficult &lt;img id="smileyfrustrated" class="emoticon emoticon-smileyfrustrated" src="https://communities.sas.com/i/smilies/16x16_smiley-frustrated.png" alt="Smiley Frustrated" title="Smiley Frustrated" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 08:34:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/604898#M175429</guid>
      <dc:creator>hannah_hortlik</dc:creator>
      <dc:date>2019-11-18T08:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Data over many years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/605032#M175497</link>
      <description>&lt;P&gt;Hi Hannah, thanks for posting your code. I went through my above post and commented what each step does. I think one of the main problems is that your source table 'drg' shares the prefix of your year tables (i.e. drg_2005). Also, it looks like you defined data_year=2005+1 which is why you're only seeing 2006 as an output. If data_year is in your drg20XX_sf datasets then you won't have to define it at all. Try my edited version and make adjustments as needed. I hope it's a little more clear now. Let me know if you have any questions!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-unison&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 15:18:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/605032#M175497</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2019-11-18T15:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: Data over many years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/605045#M175499</link>
      <description>&lt;P&gt;Since your data is already divided into data_years, this would be a quicker way to do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*sets a prefix for your tables;
%let pfx = drg20;

*Combines all datasets in work with the prefix you chose. -- sets dsname to the dataset name.;
data combine;
set sasuser.&amp;amp;pfx.: indsname=dataset;
dsname=dataset;
run;

*Execute proc freq on combine show tables by dsname and sex.;
proc freq 
	data=combine; 
	tables dsname*sex; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;-unison&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 15:22:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/605045#M175499</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2019-11-18T15:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: Data over many years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/605360#M175685</link>
      <description>&lt;P&gt;Thank you for your edited Text, it helped to understand what everything stands for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I use the Codes from your last post:&lt;/P&gt;&lt;P&gt;I get one output, namend Combine&lt;/P&gt;&lt;P&gt;And so many errors that I don't even know where to start.&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;&lt;P&gt;When I use a different code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro muster;&lt;/P&gt;&lt;P&gt;%do year = 2005 %to 2017;&lt;/P&gt;&lt;P&gt;data drg_&amp;amp;year;&lt;BR /&gt;set daten.&amp;amp;datenname.&amp;amp;year&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;ods html close;&lt;/P&gt;&lt;P&gt;proc datasets library=work nolist;&lt;BR /&gt;delete drg_&amp;amp;year;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend muster;&lt;/P&gt;&lt;P&gt;%muster&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It runs threw the years, but says:&lt;/P&gt;&lt;P&gt;Data DATEN.DRG2005.DATA doesn't exist&lt;/P&gt;&lt;P&gt;For every year&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well that's right, because the data is namend drg2005_sf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I change to:&lt;/P&gt;&lt;P&gt;data drg_&amp;amp;year;&lt;BR /&gt;set daten.&amp;amp;datenname.&amp;amp;year&lt;STRONG&gt;_sf&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then it says:&lt;/P&gt;&lt;P&gt;ERROR: Data DATEN.DRG.DATA doesn't exist&lt;/P&gt;&lt;P&gt;ERROR: Undeclared array referenced: year_sf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 11:19:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/605360#M175685</guid>
      <dc:creator>hannah_hortlik</dc:creator>
      <dc:date>2019-11-19T11:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Data over many years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/605401#M175709</link>
      <description>&lt;P&gt;Aren’t those datasets in your ‘sasuser’ library? As opposed to this ‘daten’ library.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 14:14:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/605401#M175709</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2019-11-19T14:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Data over many years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/605757#M175814</link>
      <description>The datasets are in both. And even if I change That it it doesn‘t matter</description>
      <pubDate>Wed, 20 Nov 2019 14:52:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/605757#M175814</guid>
      <dc:creator>hannah_hortlik</dc:creator>
      <dc:date>2019-11-20T14:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Data over many years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/605782#M175827</link>
      <description>&lt;P&gt;Change '&amp;amp;year_sf' to '&amp;amp;year._sf'&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 15:26:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/605782#M175827</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2019-11-20T15:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: Data over many years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/605845#M175848</link>
      <description>You made my day. It works - the way I want it and the way it should work, finally. Thank you so much for your help and time! Just because of one ".", crazy. I have to get used to this. You don't know how thankful I am, have a wonderful day.</description>
      <pubDate>Wed, 20 Nov 2019 17:21:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/605845#M175848</guid>
      <dc:creator>hannah_hortlik</dc:creator>
      <dc:date>2019-11-20T17:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: Data over many years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/605988#M175908</link>
      <description>&lt;P&gt;My pleasure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case your macro variable was called 'year', so you need to tell SAS where your macro variable ends when you type 'year' followed by '_sf'. The way to do that is with the '.' -- otherwise, SAS thinks your macro variable is called 'year_sf'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-unison&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 02:26:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-over-many-years/m-p/605988#M175908</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2019-11-21T02:26:33Z</dc:date>
    </item>
  </channel>
</rss>

