Dear SAS users,
The macro variable "thisyear" cannot be resolved in the Filename statement.
%let thisyear = 2024;
filename DIRLIST2 pipe 'dir "\\msnlgoudcp3102\nlgouddata\GLC\LZ-analyses\to be printed\&thisyear\vetzuur" /s';
data dirlist_LZ;
length buffer $256 ;
format file $200. GLC_where $3.;
infile dirlist2 length=reclen ;
input buffer $varying256. reclen;
run;
Could you please offer a solution how to solve?Hello @Cornelis,
The outer single quotes prevent the resolution of the macro variable reference. Use double quotes instead and duplicate the existing inner double quotes:
filename DIRLIST2 pipe "dir ""\\msnlgoudcp3102\nlgouddata\GLC\LZ-analyses\to be printed\&thisyear\vetzuur"" /s";
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.