BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
librasonali
Quartz | Level 8

hello , 

I have atatched my sas code. Could not figure out that why in my path  cdf.sas7bdat is also created after running the attached code (cdf.sas) file. 

--- cd /path/

--ls -ltr  

Nov 6 02:51 cdf.sas
-595853312 Nov 6 02:52 cdf.sas7bdat
1967932410 Nov 6 02:53 cdf20201103.csv
100279 Nov 6 02:53 cdf.log

 

can you pls tell me what to fix in the code so that .sas7bdat ( dataset) doesn't come after running. Help is really appreciated. Thanks 🙂 

 

 

Code :

 

 

%LET DT=110320;
%LET DT1=DT1_MMDDYY; /* DCF */
%let DT2=20201103;
%let DT3=DT3_YYYYMMDD; /* DCF */

libname s1 "/stage_1/download/backup/adhoc/kyccrs/&DT./bestbuy_cdf_daily";
libname s2 "/stage_1/download/backup/adhoc/kyccrs/&DT./canada_rpl_cdf_daily";
libname s3 "/stage_1/download/backup/adhoc/kyccrs/&DT./canada_thd_cdf_daily";
libname s4 "/stage_1/download/backup/adhoc/kyccrs/&DT./cobrand_bestbuy_cdf_daily";
libname s5 "/stage_1/download/backup/adhoc/kyccrs/&DT./cobrand_oil_shell_cdf_daily";
libname s6 "/stage_1/download/backup/adhoc/kyccrs/&DT./cobrand_rpl_cdf_daily";
libname s7 "/stage_1/download/backup/adhoc/kyccrs/&DT./cobrand_thd_cdf_daily";


libname out "/master/dev/adhoc/jay/sb56634/";

options obs=max yearcutoff=1940 ;

%macro a;
%mend;


Data out.cdf(keep=DAILYDTE
CDF_SPA
CDF_RELEASE_VERSION
CDF_SYSTEM
CDF_PRINCIPAL
CDF_AGENT
CDF_ACCOUNT_NUMBER
CDF_CLIENT_NUMBER
CDF_DATE_LAST_ACTIVE
DTTRMCHG
APPLDATE
INTLDATE
CTC_KYC_EXCP_IN
PAYDEXDT
);
set s1.cdf&DT.%a
s2.cdf&DT.%a
s3.cdf&DT.%a
s4.cdf&DT.%a
s5.cdf&DT.%a
s6.cdf&DT.%a
s7.cdf&DT.%a


;
run;

proc export data = out.cdf
outfile="/master/dev/adhoc/jay/sb56634/cdf&DT2..csv"
dbms=csv replace;
delimiter = '|';
run;
%sysexec chmod 777 /master/dev/adhoc/jay/sb56634/cdf&DT2..csv;

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@librasonali wrote:

hello , 

I have atatched my sas code. Could not figure out that why in my path  cdf.sas7bdat is also created after running the attached code (cdf.sas) file. 

--- cd /path/

--ls -ltr  

Nov 6 02:51 cdf.sas
-595853312 Nov 6 02:52 cdf.sas7bdat
1967932410 Nov 6 02:53 cdf20201103.csv
100279 Nov 6 02:53 cdf.log

 

can you pls tell me what to fix in the code so that .sas7bdat ( dataset) doesn't come after running. Help is really appreciated. Thanks 

librasonali_0-1604655795096.png

 

 

 

 

Code :

 

 

%LET DT=110320;
%LET DT1=DT1_MMDDYY; /* DCF */
%let DT2=20201103;
%let DT3=DT3_YYYYMMDD; /* DCF */

libname s1 "/stage_1/download/backup/adhoc/kyccrs/&DT./bestbuy_cdf_daily";
libname s2 "/stage_1/download/backup/adhoc/kyccrs/&DT./canada_rpl_cdf_daily";
libname s3 "/stage_1/download/backup/adhoc/kyccrs/&DT./canada_thd_cdf_daily";
libname s4 "/stage_1/download/backup/adhoc/kyccrs/&DT./cobrand_bestbuy_cdf_daily";
libname s5 "/stage_1/download/backup/adhoc/kyccrs/&DT./cobrand_oil_shell_cdf_daily";
libname s6 "/stage_1/download/backup/adhoc/kyccrs/&DT./cobrand_rpl_cdf_daily";
libname s7 "/stage_1/download/backup/adhoc/kyccrs/&DT./cobrand_thd_cdf_daily";


libname out "/master/dev/adhoc/jay/sb56634/";

proc export data = out.cdf
outfile="/master/dev/adhoc/jay/sb56634/cdf&DT2..csv"
dbms=csv replace;
delimiter = '|';
run;


The LIBNAME statement is a storage location. You placed the data set CDF in the Library named OUT and told SAS to use that same location for the output. Please look at the highlighted code above.

 

If you want the SAS data set in a different location then use a different path in the LIBNAME statement or export the data set to a different path.

 

 

View solution in original post

4 REPLIES 4
Shmuel
Garnet | Level 18

You did not attached your code.

Please copy your code using the "running man" icon: 

Shmuel_0-1604654045092.png

 

librasonali
Quartz | Level 8
i have mentioned the code. please check . Thanks 🙂
librasonali
Quartz | Level 8

hello , 

I have atatched my sas code. Could not figure out that why in my path  cdf.sas7bdat is also created after running the attached code (cdf.sas) file. 

--- cd /path/

--ls -ltr  

Nov 6 02:51 cdf.sas
-595853312 Nov 6 02:52 cdf.sas7bdat
1967932410 Nov 6 02:53 cdf20201103.csv
100279 Nov 6 02:53 cdf.log

 

can you pls tell me what to fix in the code so that .sas7bdat ( dataset) doesn't come after running. Help is really appreciated. Thanks 

librasonali_0-1604655795096.png

 

 

 

 

Code :

 

 

%LET DT=110320;
%LET DT1=DT1_MMDDYY; /* DCF */
%let DT2=20201103;
%let DT3=DT3_YYYYMMDD; /* DCF */

libname s1 "/stage_1/download/backup/adhoc/kyccrs/&DT./bestbuy_cdf_daily";
libname s2 "/stage_1/download/backup/adhoc/kyccrs/&DT./canada_rpl_cdf_daily";
libname s3 "/stage_1/download/backup/adhoc/kyccrs/&DT./canada_thd_cdf_daily";
libname s4 "/stage_1/download/backup/adhoc/kyccrs/&DT./cobrand_bestbuy_cdf_daily";
libname s5 "/stage_1/download/backup/adhoc/kyccrs/&DT./cobrand_oil_shell_cdf_daily";
libname s6 "/stage_1/download/backup/adhoc/kyccrs/&DT./cobrand_rpl_cdf_daily";
libname s7 "/stage_1/download/backup/adhoc/kyccrs/&DT./cobrand_thd_cdf_daily";


libname out "/master/dev/adhoc/jay/sb56634/";

options obs=max yearcutoff=1940 ;

%macro a;
%mend;


Data out.cdf(keep=DAILYDTE
CDF_SPA
CDF_RELEASE_VERSION
CDF_SYSTEM
CDF_PRINCIPAL
CDF_AGENT
CDF_ACCOUNT_NUMBER
CDF_CLIENT_NUMBER
CDF_DATE_LAST_ACTIVE
DTTRMCHG
APPLDATE
INTLDATE
CTC_KYC_EXCP_IN
PAYDEXDT
);
set s1.cdf&DT.%a
s2.cdf&DT.%a
s3.cdf&DT.%a
s4.cdf&DT.%a
s5.cdf&DT.%a
s6.cdf&DT.%a
s7.cdf&DT.%a


;
run;

proc export data = out.cdf
outfile="/master/dev/adhoc/jay/sb56634/cdf&DT2..csv"
dbms=csv replace;
delimiter = '|';
run;
%sysexec chmod 777 /master/dev/adhoc/jay/sb56634/cdf&DT2..csv;

ballardw
Super User

@librasonali wrote:

hello , 

I have atatched my sas code. Could not figure out that why in my path  cdf.sas7bdat is also created after running the attached code (cdf.sas) file. 

--- cd /path/

--ls -ltr  

Nov 6 02:51 cdf.sas
-595853312 Nov 6 02:52 cdf.sas7bdat
1967932410 Nov 6 02:53 cdf20201103.csv
100279 Nov 6 02:53 cdf.log

 

can you pls tell me what to fix in the code so that .sas7bdat ( dataset) doesn't come after running. Help is really appreciated. Thanks 

librasonali_0-1604655795096.png

 

 

 

 

Code :

 

 

%LET DT=110320;
%LET DT1=DT1_MMDDYY; /* DCF */
%let DT2=20201103;
%let DT3=DT3_YYYYMMDD; /* DCF */

libname s1 "/stage_1/download/backup/adhoc/kyccrs/&DT./bestbuy_cdf_daily";
libname s2 "/stage_1/download/backup/adhoc/kyccrs/&DT./canada_rpl_cdf_daily";
libname s3 "/stage_1/download/backup/adhoc/kyccrs/&DT./canada_thd_cdf_daily";
libname s4 "/stage_1/download/backup/adhoc/kyccrs/&DT./cobrand_bestbuy_cdf_daily";
libname s5 "/stage_1/download/backup/adhoc/kyccrs/&DT./cobrand_oil_shell_cdf_daily";
libname s6 "/stage_1/download/backup/adhoc/kyccrs/&DT./cobrand_rpl_cdf_daily";
libname s7 "/stage_1/download/backup/adhoc/kyccrs/&DT./cobrand_thd_cdf_daily";


libname out "/master/dev/adhoc/jay/sb56634/";

proc export data = out.cdf
outfile="/master/dev/adhoc/jay/sb56634/cdf&DT2..csv"
dbms=csv replace;
delimiter = '|';
run;


The LIBNAME statement is a storage location. You placed the data set CDF in the Library named OUT and told SAS to use that same location for the output. Please look at the highlighted code above.

 

If you want the SAS data set in a different location then use a different path in the LIBNAME statement or export the data set to a different path.

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 930 views
  • 0 likes
  • 3 in conversation