BookmarkSubscribeRSS Feed
Ksharp
Super User
How about:
course=substr( scan(row,')',1),findc(scan(row,')',1),' '))||')' ;

Ksharp
nickb
Calcite | Level 5
All this returned was a right parenthesis.

Also, there may be many possibilities to the course information.

ECE-101 INTRO TO ECE............... 10/FA A 3
ECE-106 CHLDHD NUTR/HLTH/SFTY...... 10/WI A 3
ENG-111 ENGLISH COMPOSITION I...... 10/WI B 3
SOC-111 GENERAL SOCIOLOGY I........ 10/FA A 3

and so on. My goal is to just get course description information. Message was edited by: nickb
Ksharp
Super User
OK.
[pre]


data temp;
infile datalines length=len ;
input row $varying200. len;
counrse=substr(row,findc(row,' ')+1,find(row,'..')-findc(row,' ')-1);
a=find(row,'..'); b=length(row);
put a= b= ;
datalines;
HIS-103 U.S. HIST (1919-PRESENT)... 08/FA B 3
ECE-101 INTRO TO ECE............... 10/FA A 3
ECE-106 CHLDHD NUTR/HLTH/SFTY...... 10/WI A 3
ENG-111 ENGLISH COMPOSITION I...... 10/WI B 3
SOC-111 GENERAL SOCIOLOGY I........ 10/FA A 3
;
run;
[/pre]


Ksharp
Ksharp
Super User
OK.
But not see your whole data, So It is hard to split the row into id name ..... etc.


[pre]
data temp;
infile datalines length=len ;
input row $varying200. len;
if findc(row,'-') gt 1 and findc(row,'-') le 10 and not missing(input(scan(row,2,' -'),?? best10.))
and not missing(input(scan(row,-1,' '),?? best10.)) then output;
datalines;
(*) Anticipates completion of in-progress and registered courses
================================================================================
Statuses: W=Waived, C=Complete, I=In progress, N=Not started
P=Pending completion of unfinished activity
================================================================================
C) 1: ENGLISH COMPOSITION - 9 HOURS REQUIRED
> ENG 111, 112, 113
Credits: 9
ENG-111 ENGLISH COMPOSITION I...... 92/WI B 3
ENG-112 ENGLISH COMPOSITION II..... 92/SP B 3
ENG-113 ENGLISH COMPOSITION III.... 92/FA B 3
================================================================================
C) 2: MATHEMATICS/NATURAL & PHYSICAL SCIENCES
Credits: 31
Complete all 3 subrequirements:
C) A: MATHEMATICS
> MINIMUM ONE COURSE FROM THE FOLLOWING: MAT 116, 117, 122,
> 201, 202, 203, 204, 215, 216 OR 218
MAT-116 COLLEGE ALGEBRA............ 93/FA C 5

C) B: SCIENCE SEQUENCE
> COMPLETE A MINIMUM OF ONE SEQUENCE WITH LABS:
Credits: 12
C) BIO 111, 112, 113 WITH LABS
Credits: 12
BIO-111 GENERAL BIOLOGY I.......... 93/SP C 4
BIO-112 GENERAL BIOLOGY II......... 93/FA C 4
BIO-113 GENERAL BIOLOGY III........ 94/WI C 4

C) C: ADD MATH & SCIENCE
> ADDITIONAL HOURS OF MATH AND/OR SCIENCE TO TOTAL 29:
04/04/11 Ayanna A. Archie Page 2
-------------------------------------------------------------------------------
Credits: 14
MAT-117 TRIGONOMETRY............... 94/WI C 4
CHE-151 GENERAL CHEMISTRY I........ 94/FA B 5
MAT-201 CALCULUS + ANALY GEOM I.... 94/FA C 5
================================================================================
C) 3: SOCIAL & BEHAVIORAL SCIENCES - 15 HOURS REQUIRED
> SELECT 15 HOURS FROM AT LEAST TWO SUBJECT AREAS:
> ECO 201, 202, 203
> GEO 101, 102, 201, 202
> PLS 101, 102, 103, 104, 200, 201
> PSY 121 AND 122 OR PSY 119
> PSY 205 AND/OR 206 - OR PSY 208
> PSY 207, 217, 223, 225, 228, 242
> SOC 111 AND 112 OR SOC 120
> SOC 145, 160, 205, 208, 215, 226
Credits: 15
PSY-121 GENERAL PSYCHOLOGY I....... 92/WI C 3
PLS-101 AMERICAN FEDERAL GOVT I.... 92/SP C 3
ECO-201 PRIN OF ECONOMICS I........ 92/SP B 3
ECO-202 PRIN OF ECONOMICS II....... 93/WI C 3
PLS-102 AMERICAN FEDERAL GOVT II... 93/WI B 3
================================================================================
I) 4: ARTS & HUMANITIES - 15 HOURS REQUIRED
> SELECT 15 HOURS FROM AT LEAST TWO SUBJECT AREAS:
> ART 101, 102, 125, 231, 232, 233, 235, 236
> DAN 155, 157
> HIS 101, 102, 103, 105, 111, 112, 113, 214, 215, 216, 217
> HUM 125, 130, 131, 255
> LIT 201, 202, 203, 211, 212, 213, 217, 227, 230, 234
> MUS 115, 131, 132, 133
> PHI 204, 205, 206
> REL 111, 112, 135, 204
> THE 105, 201, 202, 203
Credits: 9 Required: 15 Remaining: 6
MUS-115 MUSIC APPRECIATION......... 93/WI B 3
HIS-111 WESTERN CIV (0-1300)....... 96/WI B 3
HIS-112 WEST CIV (1300-1815)....... 96/SP B 3
____________________________________________________ 6 credits needed
================================================================================
C) 5: COMPUTER COMPETENCY - 3 HOURS REQUIRED
> TAKE ONE COURSE FROM THE FOLLOWING:
> CIS 111, CIS/BIS 119, CIS/BIS/0IS 160
> CHE 152
> MAT 220
CIS-119 PC APPLICATIONS IN BUS..... 92/FA B 3
================================================================================
;
run;

[/pre]


Ksharp
Peter_C
Rhodochrosite | Level 12
> I'm starting to try to parse this and need a few tips
>
> For example, one piece of data that I need is a line
> Student............: John Doe (0012345)
>
> The row will always start with the word 'Student' and

> length of 7. All I need is the number inside the
>
data work.audit;
infile 'D:\temp\nick_tmp\DA.txt' dlm=' )' length=len;
/* add ) to valid delimiters (will lose it with simple input */
input starting :$20. @1 @ ;
IF _infile_ ='' then delete;
if starting =: 'Student' then input @'(' StudentID @1 @ ;
run;

or
data work.audit;
infile 'D:\temp\nick_tmp\DA.txt' dlm=' )' ;
input @'Student' @'(' StudentID @1 @ ;
run;
Ksharp
Super User
Can you explain how to parse it with sql.
I only can offer you how to load the whole file into dataset.
[pre]
data temp;
infile datalines length=len ;
input row $varying200. len;
datalines;
StudentA

ADVISOR:
PLACEMENT TESTS: DISMISSALS: 0
CURRENT STANDING: GS

Completion of program will be determined by completion of each
requirement, required credit hours and final Institutional GPA.

Program Status: In Progress
Current.......... Anticipated(*).......
Required Earned Remaining Additional Remaining
Institutional Credits: 30.00 87.00 0.00 0.00 0.00
Institutional GPA....: 2.000 3.132 Met
Combined Credits: 94.00 87.00 7.00 0.00 7.00
Combined GPA....: 2.000 3.132 Met


StudentB

Completion of program will be determined by completion of each
requirement, required credit hours and final Institutional GPA.

Program Status: In Progress
Current.......... Anticipated(*).......
Required Earned Remaining Additional Remaining
Institutional Credits: 30.00 49.00 0.00 8.00 0.00
Institutional GPA....: 2.000 3.174 Met
Combined Credits: 106.00 49.00 57.00 8.00 49.00
Combined GPA....: 2.000 3.174 Met
;
run;
[/pre]

Ksharp

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
  • 20 replies
  • 1228 views
  • 0 likes
  • 6 in conversation