<?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: Use 2 dependant variables in a macro/loop in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Use-2-dependant-variables-in-a-macro-loop/m-p/523494#M4633</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/252475"&gt;@Masande&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for your answer.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately, it doesn't seem to be working. If I launch it once, the data sets are not created (no error in logs) and if I launch it again, log notes give this kind of message :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; NOTE: The quoted string currently being processed has become more than 262 bytes long.  You might have unbalanced quotation marks.
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 2          TITLE;
 3          FOOTNOTE;
 4          OPTIONS LOCALE=en_US DFLANG=LOCALE;
 5          DATA _NULL_;
 89         &amp;amp;GRAPHTERM; ;*';*";*/;RUN;QUIT;
                          _________________
                          49
 NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release.  Inserting white space 
              between a quoted string and the succeeding identifier is recommended.
 
 6          RUN;
 7          OPTIONS VALIDVARNAME=ANY;
 8          OPTIONS VALIDMEMNAME=EXTEND;
 9          FILENAME _HTMLOUT TEMP;
 10         FILENAME _RTFOUT TEMP ENCODING='UTF-8';
 10         FILENAME _RTFOUT TEMP ENCODING='UTF-8'
                                                 _
                                                 49
 10       ! ;
 NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release.  Inserting white space 
              between a quoted string and the succeeding identifier is recommended.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I tried with the following code too (I think that you made few typos l.1, l.4 and l.9) but the problem remains :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro player(player=,data=,out=);
data &amp;amp;out.;
	infile "&amp;amp;data." dlm=';' dsd firstobs=2;
	input stf :$50. rolb :$50. last_game_date :yymmdd.;
	format last_game_date ddmmyy10.;
	player="&amp;amp;player.";
run;
%mend player;
%macro player(player=Frank Anderson,data=/data/import217_anderson.txt,out=player1);
%macro player(player=Tom Wilson,data=/data/wilson_skj.txt,out=player2);
%macro player(player=Andrew Pelbigone,data=/data/pelbigone_fhz_rtf.txt,out=player3);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My (redundant and tedious) code had no problem creating datasets so the input shouldn't be the problem.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Start a new session; you have unbalanced quotes from previous code.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Dec 2018 19:24:58 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-12-25T19:24:58Z</dc:date>
    <item>
      <title>Use 2 dependant variables in a macro/loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-2-dependant-variables-in-a-macro-loop/m-p/523411#M4612</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In SAS Base 9.4, I'd like to create n datasets based on n .txt files (player files) then add a variable into the datasets containing the name of the player. I currently use macro variables for the player name and the file path, but it creates tedious redundancy.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let player1 = Frank Anderson;
%let dir1 = /data/import217_anderson.txt;
%let player2 = Tom Wilson;
%let dir2  = /data/wilson_skj.txt;
%let player3 = Andrew Pelbigone;
%let dir3  = /data/pelbigone_fhz_rtf.txt;

data player1;
	infile "&amp;amp;dir1" dlm=';' dsd firstobs=2;
	input stf :$50. rolb :$50. last_game_date :yymmdd. 
	format last_game_date ddmmyy10.;
	player="&amp;amp;player1";
run;

data player2;
	infile "&amp;amp;dir2" dlm=';' dsd firstobs=2;
	input stf :$50. rolb :$50. last_game_date :yymmdd. 
	format last_game_date ddmmyy10.;
	player="&amp;amp;player2";
run;

data player3;
	infile "&amp;amp;dir3" dlm=';' dsd firstobs=2;
	input stf :$50. rolb :$50. last_game_date :yymmdd. 
	format last_game_date ddmmyy10.;
	player="&amp;amp;player3";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to make the addition of extra players and paths&amp;nbsp;smoother (not have to create a macro variable for each name AND path) and also reduce the size of the code needed to create data sets: while it's not&amp;nbsp;tedious for 2-3 players, it's difficult for a longer player list.&amp;nbsp;I guess you have to go through a macro/loop to create data sets and use some lists/arrays for the initial inputs but I'm not sure this is the optimal solution and&amp;nbsp;how to implement it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Optimally, I search a solution for an unknown n-number of .txt files and&amp;nbsp;variable .txt files (the files have the same data structure but not the same name structure, ie one can be "player.txt" and the next one "import_123.txt"). The player names are known.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your support !&lt;/P&gt;</description>
      <pubDate>Mon, 24 Dec 2018 16:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-2-dependant-variables-in-a-macro-loop/m-p/523411#M4612</guid>
      <dc:creator>Masande</dc:creator>
      <dc:date>2018-12-24T16:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Use 2 dependant variables in a macro/loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-2-dependant-variables-in-a-macro-loop/m-p/523414#M4613</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro player(player=,data=.out=);
data &amp;amp;out.;
	infile "&amp;amp;data." dlm=';' dsd firstobs=2;
	input stf :$50. rolb :$50. last_game_date :yymmdd. 
	format last_game_date ddmmyy10.;
	player="&amp;amp;player.";
run;
%mend player;
%macro player(player=Frank Anderson,data=data/import217_anderson.txt,out=player1);
%macro player(player=Tom Wilson,data=/data/wilson_skj.txt,out=player2);
%macro player(player=Andrew Pelbigone,data=/data/pelbigone_fhz_rtf.txt,out=player3);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Dec 2018 17:03:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-2-dependant-variables-in-a-macro-loop/m-p/523414#M4613</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-12-24T17:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Use 2 dependant variables in a macro/loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-2-dependant-variables-in-a-macro-loop/m-p/523422#M4616</link>
      <description>&lt;P&gt;Thank you for your answer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, it doesn't seem to be working. If I launch it once, the data sets are not created (no error in logs) and if I launch it again, log notes give this kind of message :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; NOTE: The quoted string currently being processed has become more than 262 bytes long.  You might have unbalanced quotation marks.
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 2          TITLE;
 3          FOOTNOTE;
 4          OPTIONS LOCALE=en_US DFLANG=LOCALE;
 5          DATA _NULL_;
 89         &amp;amp;GRAPHTERM; ;*';*";*/;RUN;QUIT;
                          _________________
                          49
 NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release.  Inserting white space 
              between a quoted string and the succeeding identifier is recommended.
 
 6          RUN;
 7          OPTIONS VALIDVARNAME=ANY;
 8          OPTIONS VALIDMEMNAME=EXTEND;
 9          FILENAME _HTMLOUT TEMP;
 10         FILENAME _RTFOUT TEMP ENCODING='UTF-8';
 10         FILENAME _RTFOUT TEMP ENCODING='UTF-8'
                                                 _
                                                 49
 10       ! ;
 NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release.  Inserting white space 
              between a quoted string and the succeeding identifier is recommended.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I tried with the following code too (I think that you made few typos l.1, l.4 and l.9) but the problem remains :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro player(player=,data=,out=);
data &amp;amp;out.;
	infile "&amp;amp;data." dlm=';' dsd firstobs=2;
	input stf :$50. rolb :$50. last_game_date :yymmdd.;
	format last_game_date ddmmyy10.;
	player="&amp;amp;player.";
run;
%mend player;
%macro player(player=Frank Anderson,data=/data/import217_anderson.txt,out=player1);
%macro player(player=Tom Wilson,data=/data/wilson_skj.txt,out=player2);
%macro player(player=Andrew Pelbigone,data=/data/pelbigone_fhz_rtf.txt,out=player3);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My (redundant and tedious) code had no problem creating datasets so the input shouldn't be the problem.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Dec 2018 18:05:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-2-dependant-variables-in-a-macro-loop/m-p/523422#M4616</guid>
      <dc:creator>Masande</dc:creator>
      <dc:date>2018-12-24T18:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: Use 2 dependant variables in a macro/loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-2-dependant-variables-in-a-macro-loop/m-p/523428#M4618</link>
      <description>&lt;P&gt;I solved the previous problem with the current code :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro player(play, dir, out);
	data &amp;amp;out;
	    infile &amp;amp;dir dlm=';' dsd firstobs=2;
	    input stf :$50. rolb :$50. last_game_date :yymmdd.;
	    format last_game_date ddmmyy10.;
	    player=&amp;amp;play;
	run;

%mend;

%player("Frank Anderson", "/data/import217_anderson.txt", Player1);
%player("Tom Wilson", "/data/wilson_skj.txt", Player2);
%player("Andrew Pelbigone", "/data/pelbigone_fhz_rtf.txt", Player3);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, it still have some redundancy with the macro call (1 for each player). Can we make it smoother for n players ? It would be pretty tedious for 100 players and it won't solve one part of the initial problem: we don't know the starting player number (and the number of files to convert therefore).&lt;/P&gt;</description>
      <pubDate>Mon, 24 Dec 2018 19:55:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-2-dependant-variables-in-a-macro-loop/m-p/523428#M4618</guid>
      <dc:creator>Masande</dc:creator>
      <dc:date>2018-12-24T19:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Use 2 dependant variables in a macro/loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-2-dependant-variables-in-a-macro-loop/m-p/523494#M4633</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/252475"&gt;@Masande&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for your answer.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately, it doesn't seem to be working. If I launch it once, the data sets are not created (no error in logs) and if I launch it again, log notes give this kind of message :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; NOTE: The quoted string currently being processed has become more than 262 bytes long.  You might have unbalanced quotation marks.
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 2          TITLE;
 3          FOOTNOTE;
 4          OPTIONS LOCALE=en_US DFLANG=LOCALE;
 5          DATA _NULL_;
 89         &amp;amp;GRAPHTERM; ;*';*";*/;RUN;QUIT;
                          _________________
                          49
 NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release.  Inserting white space 
              between a quoted string and the succeeding identifier is recommended.
 
 6          RUN;
 7          OPTIONS VALIDVARNAME=ANY;
 8          OPTIONS VALIDMEMNAME=EXTEND;
 9          FILENAME _HTMLOUT TEMP;
 10         FILENAME _RTFOUT TEMP ENCODING='UTF-8';
 10         FILENAME _RTFOUT TEMP ENCODING='UTF-8'
                                                 _
                                                 49
 10       ! ;
 NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release.  Inserting white space 
              between a quoted string and the succeeding identifier is recommended.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I tried with the following code too (I think that you made few typos l.1, l.4 and l.9) but the problem remains :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro player(player=,data=,out=);
data &amp;amp;out.;
	infile "&amp;amp;data." dlm=';' dsd firstobs=2;
	input stf :$50. rolb :$50. last_game_date :yymmdd.;
	format last_game_date ddmmyy10.;
	player="&amp;amp;player.";
run;
%mend player;
%macro player(player=Frank Anderson,data=/data/import217_anderson.txt,out=player1);
%macro player(player=Tom Wilson,data=/data/wilson_skj.txt,out=player2);
%macro player(player=Andrew Pelbigone,data=/data/pelbigone_fhz_rtf.txt,out=player3);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My (redundant and tedious) code had no problem creating datasets so the input shouldn't be the problem.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Start a new session; you have unbalanced quotes from previous code.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Dec 2018 19:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-2-dependant-variables-in-a-macro-loop/m-p/523494#M4633</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-12-25T19:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: Use 2 dependant variables in a macro/loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-2-dependant-variables-in-a-macro-loop/m-p/523496#M4635</link>
      <description>&lt;P&gt;Put all files with identical structure (and only those)in a directory, and use wildcards to read all files in one step. Use the filename= option to retrieve the name of the currently read file.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Dec 2018 19:29:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-2-dependant-variables-in-a-macro-loop/m-p/523496#M4635</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-12-25T19:29:17Z</dc:date>
    </item>
  </channel>
</rss>

