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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 769 views
  • 0 likes
  • 3 in conversation