BookmarkSubscribeRSS Feed
SYN
Obsidian | Level 7 SYN
Obsidian | Level 7


I am getting one .CSV file along with control file.

Control file having number of records in .CSV file.

How can I check the records count in control file and .csv file records count.

Please any one help me about this. Thanks in advance.

Sreenivasa
2 REPLIES 2
Patrick
Opal | Level 21

One way to go:

You first read both the control and data file. Then you add a user written code node (or a user transformation if such comparison is used for more than one file). The code could look like something below ( not tested):

Data _null_;

call symput('nobs',cats(nobs));

stop;

set <my data> nobs=nobs;

run;

data _null_;

set <control>;

if <ctrl var containing number of obs> ne &nobs then <do something>;

run;

shivas
Pyrite | Level 9

Hi Syn,

You can create control table using Library contents transformation(please read it).

For example purpose i have hard coded the value(but you can get his values from control table) .

First create a job with your csv file and load into data set.After job is created then add post process code.

Hope this helps..

control1.png

control table.png

log

2050       data _null_;

2051       if &x=5 then job="Success";

2052       else job="fail";

2053       put job=;

2054       ;

2055       run;

job=Success

Thanks,

Shiva

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 886 views
  • 0 likes
  • 3 in conversation