DATA Step, Macro, Functions and more

Programming Techniques for SAS In-Memory Analytics for Hadoop

Reply
Contributor
Posts: 56

Programming Techniques for SAS In-Memory Analytics for Hadoop

data functions;
infile datalines dlm=' ' dsd missover;
input x $ 50.;
x1=scan(x,1," ");
x2=scan(x,2," ");
x3=scan(x,3," ");
x4=scan(x,4," ");
x5=scan(x,5," ");
x6=scan(x,2," ");
datalines;
abc123@#$	abc	123	@#$	 abc123	abc@#$ 
def123		def 123  	 def123 	   
456@#$   		456 @#$				   
@&*rtg 		rtg  	@&*  		@&*rtg 
qwerty	 qwerty   					   
!@#$%   			!@#$%			   
123456   		12345				   
;
run;
Super User
Posts: 13,300

Re: Programming Techniques for SAS In-Memory Analytics for Hadoop

Posted in reply to rvsidhu035

And the question is?

Contributor
Posts: 56

Re: Programming Techniques for SAS In-Memory Analytics for Hadoop

we want missing values if not have scan values means consecutive space take as missing values

Super User
Posts: 23,249

Re: Programming Techniques for SAS In-Memory Analytics for Hadoop

Posted in reply to rvsidhu035

rvsidhu035 wrote:

we want missing values if not have scan values means consecutive space take as missing values


You need to post more details about what your question is and what issues you're having if you need help. 

Contributor
Posts: 56

Re: Programming Techniques for SAS In-Memory Analytics for Hadoop

def123        def    123               def123

 

this one 2nd obs

here x1=def123 x2=def x3=123 x4=x5=missing,x6=def123

we want above output by using sas functions only its possible

PROC Star
Posts: 1,566

Re: Programming Techniques for SAS In-Memory Analytics for Hadoop

Posted in reply to rvsidhu035

I have no clue what you are after. I am guessing perhaps to fetch these records?

 

 

data functions;

infile datalines dlm=' ' dsd missover;

input x $ 50.;

datalines;

abc123@#$   abc   123   @#$   abc123     abc@#$

def123            def 123      def123        

456@#$            456 @#$                         

@&*rtg            rtg  @&*         @&*rtg

qwerty      qwerty                                

!@#$%                   !@#$%               

123456            12345                     

;

run;

 

data want;

set functions;

if anypunct(x)=0;

run;

Esteemed Advisor
Posts: 5,479

Re: Programming Techniques for SAS In-Memory Analytics for Hadoop

Posted in reply to rvsidhu035

Your input text is tab delimited. It reads fine from a regular text file:

 

data functions;
infile "&sasforum\datasets\rvsidhu035.txt" dsd dlm="09"x missover;
input (x1-x6) (:$10.);
run;

proc print; var x1-x6; run;
        Obs    x1           x2        x3         x4          x5        x6

         1     abc123@#$    abc       123        @#$       abc123    abc@#$
         2     def123                 def 123    def123
         3     456@#$                 456 @#$
         4     @&*rtg                 rtg        @&*                 @&*rtg
         5     qwerty       qwerty
         6     !@#$%                             !@#$%
         7     123456                 12345
PG
Ask a Question
Discussion stats
  • 6 replies
  • 138 views
  • 1 like
  • 5 in conversation