Why not simply put the macro invocation itself? proc sql noprint In this case it's unimportant, but sometimes the middle bits have more parentheses in them, and it becomes unclear when you have the right number.Īll this aside, you're making this much too complicated. The final ')' is unnecessary (it could be included inside the double quotes), but I like it for readability (it makes it obvious that it's the end of the macro invocation). It would be okay for &path not to resolve (as it's a global variable), but &file&i absolutely needs to, since it's what you are looping over. The goal here is to make sure %importcsv doesn't resolve - so we wrap it in single quotes - but get the macro variables to resolve - wrapped in double quotes. The right way to do this is: call execute(cats('%importcsv(',"&path.\&file&i.",')')) Second: you have single quotes inside single quotes, or else you have unquoted text. You also, though, don't want %importcsv itself to resolve. It's clear why you need to use it, but not why you're currently using it.įirst: you have single quotes around the string, which means it won't resolve the macro variables. It's unclear why you're even using cats, as you aren't really concatenating anything. call execute(cats('%importcsv('&path.\&file&i')')) Looking at logs there seems to be something wrong with call execute line, but for the life of me I cannot fix it.Īs regards the requested call execute line, this will not work. %if %datatyp(%qsubstr(&badname,1,1))=NUMERIC My attempt so far is this: %let path=my_dir I have XCMD disabled, so pipe solution isn't usable for me (the only solution my course provided me, so several exercises are a bit problematic for me). I am to use separated macros to fix names of those files (they are intentionaly problematic for SAS) and actually import them. I have to scan a target directory, and import every CSV file there into SAS.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |