BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ksharp
Super User
data test;
infile cards truncover;
input (Bacode1-Bacode3) (: $40.);
cards;
atmbarcode:"FE235. atmbarcode:"Yu23
Atmbarcode:TU35. Row#% atmbarcode:WE45
;
run;

data have;
 set test;
length x $ 32767;
x=catx(' ',of Bacode1-Bacode3);
n+1;
pid=prxparse('/atmbarcode:\W*\w+/i');
s=1;
e=length(x);
call prxnext(pid,s,e,x,p,l);
do while(p>0);
 Bacode=substr(x,p,l);
 output;
 call prxnext(pid,s,e,x,p,l);
end;
keep n x Bacode ;

proc transpose data=have out=want(drop=_name_) prefix=Bacode;
by n x;
var Bacode;
run;
Beto16
Obsidian | Level 7
Hi Ksharp I copy your code an refer Test table an prxparse atmbarcode: an did the the catx to include only the columns I want to select even though it'sbe 600 ...an it comes back when I use cards it works beautiful. ..when I try to refer table it fail. ..i really appreciate your help
Beto16
Obsidian | Level 7
Do you see anything I might be missing?
Ksharp
Super User

Your Error Log information ?

 

Post a TEXT/CSV file contains your TEST data.

 

Run    PROC CONTENTS DATA=TEST;RUN;   and post the result.

Beto16
Obsidian | Level 7
The sas system
The contents procedure
Data set name work.test. observation 136
Member name Data. Variables. 255
engine. V9. Indexes. 0
Created.06/22/16. 22:45:5 Observations length 5456
last modified 06/22/16 22:45:5. Deleted observation 0
Protection. Compress No
Data set type. Sorted no
Label.
Data representation win_32
Encoding latinwestern

engine /host dependant information

Data set page size. 262144
Number of data set pages 3
First data page 1
Max obs per page 48
Obs in first data page 42
Number of data set repair 0
Extendobs counter. Yes
Filename test.sas7dat
Release 9.0401m3
Host created w32_7pro


Alphabetical list of variables an attributes

# variable. Type. Len. Format informat label
3. Atm1. Char. 22. $22. $22. Atm1
4. Atm2. Char. 25. $25. $25. ATM2
5. Atm3. Char. 24. $24. , $24. Atm3
6. Atm4. Char. 19. . $19. $19. Atm4
Beto16
Obsidian | Level 7
There is 255 rows of the same data.
Ksharp
Super User
Attach a TEXT file to let us test it .
Beto16
Obsidian | Level 7
 
Beto16
Obsidian | Level 7
Here is my log Numeric values have been converted to character values at the places given by (line) column).
20658:10 20659:22 20661:15. 20663:22
Note there were 136 observation read from data set work.test. the data set want has 0 observation and 3 variables ....hope this helps as well
Beto16
Obsidian | Level 7
Thank you ksharp for everything ....using your code I fig it out
Beto16
Obsidian | Level 7
Hi Ksharp I was able to get the code to work bit now I need find atmbarcode and tracking number that starts with 1zts how can I incorporate in the code to look for both items in the code you help me with ?
Ksharp
Super User
Sorry. Can you start a new session for this question ? It is too old and hard to follow. Post the sample data and the output you want.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 26 replies
  • 4251 views
  • 0 likes
  • 4 in conversation