I'm attempting to reorganize some code and start utilizing GitLab for my organization. My plan is to commit our code base with following structure
directory/[Main]
within build.egp I run parameters.sas with an %include statement:
data _null_; name = dequote(&_clientprojectpath); cutofflen = length(&_ClientProjectNAME)+3; namelen = length(name); path = cats('\\company.com\Shares\Projects',substr(name,3,namelen-cutofflen)); *starts string after X: with sas filepath type and drops project name; path2 = substr(path,1,length(path)-5); *drops \Main path; param_CodeRef = cat(trim(path),"\parameters-0622.sas"); call symput('param_code', param_CodeRef); call symput('egp_location',path); call symput('base_directory',path2); run; %include "¶m_code.";
*snippet of related code from parameters.sas file
%let dir_build = &base_directory.\Production\&yyyy.\&mm.\Build;
%let dir_prep = &dir_build.\Source;
The problem is that the variable has a line split (enter key) causing the %let statement to create multiple records in macro variable value viewer, neither of them usable.
e.g.
%put &dir_prep.;
output;
"&base_directory. [actual directory does output]
\Production\2022\06\Build"
I think my near term problem is solved if I can create %let statements with &base_directory. and no enter keys.
possible causes of problem:
Turn on macro debugging options
option mprint symbolgen;
Then run this segment of code again and the show us the entire log for this section of code. Copy the log as text and paste it into the window that appears when you click on the </> icon. DO NOT SKIP THIS STEP.
SYMPUT does not add in characters.
Since your &base_directory macro variable is built using the PATH2 variable in that data _null_ you might consider 1) making an actual output data set so you can examine the values created for PATH2 without any macro involvement and 2) test for the presence of odd characters at the end and remove them if needed before creating the macro variable.
OR consider supplying the values of the macro variables &_clientprojectpath and &_ClientProjectNAME used in that data step so we can test them.
You may want to look for copy-and-paste issues where one or both of those macro variables are assigned.
This
name = dequote(&_clientprojectpath);
cannot work, as &_clientprojectpath will not contain a valid SAS variable name. Enclose the macro variable reference in quotes.
Maxim 2: Read the Log.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.