cancel
Turn on suggestions
Showing results for
Search instead for
Did you mean:
BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
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);

0 Likes
1 ACCEPTED SOLUTION

Accepted Solutions
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;
0 Likes
4 REPLIES 4
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
0 Likes
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.

0 Likes
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;
0 Likes
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
0 Likes

sasinnovate.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just 495ドル!

Register now

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
[フレーム]

AltStyle によって変換されたページ (->オリジナル) /