SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Can yone explain the following steps:

Reply
Frequent Contributor
Posts: 89

Can yone explain the following steps:

Thanks  data_null.

For the reply to the post.

I am unable to view my post Its telling unauthorised access.

Might be technical bug.

Can u just clarify the steps


infile cards col=c;
   input id :$3. @;
   call scan(_infile_,-2,s,l,' ');
   l=s-c-1;
  
input name $varying64. l dob:mmddyy12. money :comma12.;
  
format dob mmddyy10. money dollar12.;
  
drop s l;

How to import delimited space text file

created by data_null_; in Data Management - View the full discussion

data pita;
   infile cards col=c;
   input id :$3. @;
   call scan(_infile_,-2,s,l,' ');
   l=s-c-1;
  
input name $varying64. l dob:mmddyy12. money :comma12.;
  
format dob mmddyy10. money dollar12.;
  
drop s l;
   list;
  
cards;
001 Christopher Mullensc 11/12/1955 $45,200
002 Michelle Kwo 9/12/1955 $78,123
003 Roger W. McDonald 1/1/1960 $107,200
;;;;
   run;
proc print;
  
run;

Respected Advisor
Posts: 3,799

Re: Can yone explain the following steps:

Posted in reply to venkatnaveen

Since your name field is not followed by 2 or more delimiters (spaces) you cannot use the & format modifier to read the field with embedded delimiters you will need another way to figure out the location of the end of the name field.  We know that there are two fields to the right of the NAME field and we will use that information (the starting column of the date field)  to find the end of the name field.

data pita;
   infile cards col=c; *COLUMN option variable C is location of column pointer;
  
input id :$3. @; *Read the first field, C will be 4;
  
call scan(_infile_,-2,s,l,' '); *Find the S(tart) column of the 2nd word from the right;
   l=s-c-
1; *Calculate the length of name field for $VARYING informat;
  
*We have all the info now to read the rest of the fields.;
  
input name $varying64. l dob:mmddyy12. money :comma12.;
  
*Good to read SAS documentation concerning each of the statements, options, function, and informats for complete details and examples;
  
format dob mmddyy10. money dollar12.;
  
drop s l;
   list;
  
cards;
001 Christopher Mullensc 11/12/1955 $45,200
002 Michelle Kwo 9/12/1955 $78,123
003 Roger W. McDonald 1/1/1960 $107,200
;;;;
   run;
proc print;
  
run;
Frequent Contributor
Posts: 89

Re: Can yone explain the following steps:

Posted in reply to data_null__

Thanks a lot.

Ask a Question
Discussion stats
  • 2 replies
  • 276 views
  • 0 likes
  • 2 in conversation