BookmarkSubscribeRSS Feed
nickb
Calcite | Level 5
I'm using a data step to build up multiple ftp put statements and I need to remove all leading zeros. The person ID is the value with the leading zeros. I'm also trying to figure how to put the quit keyword after the last occurence. I thought last. would work but it isn't coming out correctly.

Below is the data step.

data _null_;
set work.display_data;
by person_id_nb;
file max_pics;


line1 = 'cd incoming';
line2 = 'put \\location\of\thepics' ||trim(person_id_nb) || '.jpg';
Line3 = 'quit';

if _N_ = 1 then put line1;
put line2;
if _N_ = lastobs then put line3;



run;
4 REPLIES 4
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Suggest checking the forum archives with SEARCH -- it's a popular topic. Also, you could use the END= keyword on the SET statement to detect the end-of-file condition.

Scott Barry
SBBWorks, Inc. Message was edited by: sbb
Robert_Bardos
Fluorite | Level 6
Nick,

try somewhat along these lines:


data ids ; id='00123' ; output ; id='04567' ; output ; stop ; run ;
data _null_ ;
set ids end=lastobs ;
if _n_ = 1 then put 'cd incoming' ;
idnum = input(id,best.) ;
put 'put \\your_location\' idnum +(-1) '.jpg' ;
if lastobs then put 'quit' ;
run ;

HTH
Robert Message was edited by: Robert.Bardos
nickb
Calcite | Level 5
That works great but what if the id's are coming from a temporary data set?
nickb
Calcite | Level 5
I got it to work. Thanks again for the help.

Nick

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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