BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Dawid3
Fluorite | Level 6

Hi everyone, I wrote some code for sas DI where I get the start and end time of the job.
Does anyone know how to get a number, how many row was inserted?

 

%global startTm endTm;

%macro startTiming();

%let startTm = %sysfunc(datetime());

%mend startTiming;


%macro endTiming(entry=);

%let endTm = %sysfunc(datetime());

proc sql;
insert into lib.Tab
values("&Entry", &startTm, &endTm );
quit;

%mend;


%startTiming();

CODE OF JOB

%endTiming(entry=Tab);

1 ACCEPTED SOLUTION

Accepted Solutions
Dawid3
Fluorite | Level 6
I use this code in pre-code to get the no. of records before the loader and then calculate at the end no. of records inserted, it works.

data _NULL_;
if 0 then set sashelp.class nobs=n;
call symputx('nrows',n);
stop;
run;
%put nobs=&nrows;

View solution in original post

4 REPLIES 4
LinusH
Tourmaline | Level 20

If you have access to SAS Environment Manager, I think this information would be available if you activate performance logging:

https://documentation.sas.com/doc/en/etlug/4.903/p1xs37ux2hnk80n1h9bdj5gnswcn.htm

DI Studio has the macto variable etls_recnt avaible, but that only shows the no of records in the target table after the update, not no of records added/updated. I guess that you could have a pre-code to get the no of records before the the loader, and then calculate at the end no of records inserted?

Data never sleeps
Dawid3
Fluorite | Level 6

Unfortunately I don"t have access to SAS Environment Manager.
I think I could get a pre-code to get the no. of records before the loader and then calculate at the end no. of records inserted - as you say
Can you tell me how to get it?
I would like to enter the data that I have into the table where I have the start and end time.

Dawid3
Fluorite | Level 6
I use this code in pre-code to get the no. of records before the loader and then calculate at the end no. of records inserted, it works.

data _NULL_;
if 0 then set sashelp.class nobs=n;
call symputx('nrows',n);
stop;
run;
%put nobs=&nrows;
PaigeMiller
Diamond | Level 26

I haven't tried this, but if you add

 

%put &sqlobs;

after your PROC SQL, it should display the number of observations (rows).

--
Paige Miller

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

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