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;And the question is?
we want missing values if not have scan values means consecutive space take as missing values
@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.
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
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;
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
					
				
			
			
				It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.
