BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
bhaskarkothavt
Obsidian | Level 7

Hello SAS Community,

Our team recently transitioned from Base SAS 9.4 to SAS Studio using Viya 4. We're encountering some challenges adapting our existing program that converts .dat files into SAS datasets for further analysis.

These .dat files, received quarterly from IT, act as snapshots of our database on specific dates. We use them to generate numerous datasets used across various departments.

Previously, in Base SAS 9.4, we successfully used the following code


%let tm = sp124; /*update term*/

filename extract "X:\ircensus\scf extracts from ISC\&tm\_syra600ro_cron_gr.dat";


data bgx&tm;

attrib
bstuid informat=$char9. /* spriden_id */
SEXAPPL informat=$char1. /* spbpers_sex */
ethnic informat=$char33. /* combination of spbpers_ethn_cde & gorprac_race_cde */
byrtmapp informat=$char6. /* saradap_term_code_entry */
bapplnum informat=$char2. /* saradap_appl_num */
RELCODE1 informat=$char2. /* spbpers_lgcy_code=Y */
bhonors informat=$char4. /* saraatt_atts_code=HNRE */
natnbirth informat= $char3. /* sabsupl_natn_code_birth */
firstgen informat =$char1. /* first gen from ug admissions */

.

.

.

.


;

infile extract length=linelen delimiter='^' lrecl=1000 ls=1200 firstobs=2 missover;

format
bstupidm 8. JUNORGPA 5.2 satverb satmath satm satr 3.
bbirthdt bdtaprec bdtapent bstactdt badactdt date9.
;

input
bstuid
SEXAPPL
ethnic
byrtmapp
bapplnum.

.

.

.

.

.


;

label
bstuid = 'spriden_id'
bstutype = 'saradap_styp_code'
SEXAPPL = 'spbpers_sex'
ethnic = 'spbpers_ethn_cde=NH,2=H,gorprac_race_cde=W,2=B,3=H,4=A,5=N,6=U'
satm = 'sortest_test_score, sortest_tesc_code=SATM, SAT Math 2016'
satr = 'sortest_test_score, sortest_tesc_code=SATR, SAT Reading 2016'

.

.

.

;
run;

We'd greatly appreciate any guidance on replicating this functionality or converting the code for use within SAS Studio. Any insights or suggestions would be immensely helpful!

Best Regards,

Bhaskar

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Remove the %INCLUDE statement.

 

You caused SAS to try and execute the data file as SAS commands.  If the file is appropriate for being read by your data step then it does NOT contain SAS commands.

View solution in original post

7 REPLIES 7
LinusH
Tourmaline | Level 20

It's basically Base code, so it could/should work to execute in SAS Compute, given that you place in a location you can reach from your Viya workspace.

Why not try and see what happens?

Data never sleeps
bhaskarkothavt
Obsidian | Level 7
I copied one of the .dat file to a location accessible from my SAS Viya workspace. When I ran

filename hat filesrvc folderpath="/AAI/Census/SCF Extracts from ISC" filename="_syra600ro_cron_gr.dat";
%include hat;

I am getting multiple errors which I didnt encounter while running in base sas.
ERROR: The token currently being processed is in an incomplete state. You might have an unbalanced single quoted string or a token
exceeding the maximum length of 65535 characters.
Patrick
Opal | Level 21

%include is for SAS script and not for data. 

From the looks of it you've got in your SAS9.4 code a filename and then an infile statement using the fileref. The only thing that should need change in your Viya environment is the filename. 

bhaskarkothavt
Obsidian | Level 7
I didnt even ran the data step yet. Just by running my filename statement I got the error.
LinusH
Tourmaline | Level 20
Please share the actual log.
Data never sleeps
bhaskarkothavt
Obsidian | Level 7
Here is the log
85 %let tm = fs124; /*update term*/
86
87 filename creds filesrvc folderpath = "/AAI/Connections/bhaskarkotha/" filename="credential.sas";
88 %include creds;
133
134 /*CAS S3Transit*/
135 libname s3 cas caslib ="S3Transit" datalimit = All;
NOTE: The session CASAUTO connected successfully to Cloud Analytic Services sas-cas-server-default-client using port 5570. The UUID
is 1f8d54d3-9b65-8f49-81b2-9118d4a8bce5. The user is bhaskarkotha and the active caslib is CASUSER(bhaskarkotha).
NOTE: The SAS option SESSREF was updated with the value CASAUTO.
NOTE: The SAS macro _SESSREF_ was updated with the value CASAUTO.
NOTE: The session is using 0 workers.
NOTE: Libref S3 was successfully assigned as follows:
Engine: CAS
Physical Name: 1f8d54d3-9b65-8f49-81b2-9118d4a8bce5
136
137 filename hat filesrvc folderpath="/AAI/Census/SCF Extracts from ISC" filename="_syra600ro_cron_gr.dat";
138 %include hat;
139 +STUPIDM,STUID,STUIDNUM,UPLWLAST,UPLWFRST,UPLWMIDL,UPLWINIT,GENENAME,SEXAPPL,RACEAPPL,BIRTHDTE,YRTMAPPL,APPLNUM,RELCODE1,HONORS
-------
180
139 !+,HONORFLG,CADETFLG,ROTCBRNC,APSTACDE,ADMACTON,STUACTON,DTAPLREC,DTAPLENT,STUACTDT,ADMACTDT,CURRFRST,CURRSCND,CURROFFD,COLCODE,
139 !+TOEFLAGG,SATVERB,SATMATH,ACTCOMP,ACTENG,ACTMATH,ACHENGL,JUNORGPA,HSCODE,HSNAME,CLASRANK,CLASSIZE,INOUTSTA,ADDR1LN1,ADDR2LN1,AD
139 !+RCITY1,ADRSTAT1,ADRZIP1,ADRCTRY1,ADDR1LN2,ADDR2LN2,ADRCITY2,ADRSTAT2,ADRZIP2,ADRCTRY2,ADREMAL1,ADREMALP,HOMEARE1,HOMEPRE1,HOME
139 !+NUM1,HOMEARE2,HOMEPRE2,HOMENUM2,FIRSPORT,SPTDESC1,SECSPORT,SPTDESC2,CITZCODE,CTRYCITZ,ADMTYPE,STUTYPE,DORMFLG,COLLMAJ,LEVEL,TO
139 !+EFL1,TOEFL2,TOEFL3,VISATYPE,COLFRST,HSSTATE,OPT1OFFD,APDCCODE,SITECODE,CAMPCODE,GREVERB,GREQUAN,GREANAL,GMAT,COLLNOW,CURRTHRD,
139 !+CURRFRTH,CURRFFTH,DECSNNO,WTHDRWCD,WTHDRWNM,OTHRCOLL,OTHRTITL,GR04,GR05,TOEFL5,TOEFLE,NATNADM,NATNBIRTH,FIRSTGEN,SATM,SATR,SAT
139 !+NCAV
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
ERROR: The token currently being processed is in an incomplete state. You might have an unbalanced single quoted string or a token
exceeding the maximum length of 65535 characters.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
ERROR: The token currently being processed is in an incomplete state. You might have an unbalanced single quoted string or a token
exceeding the maximum length of 65535 characters.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
ERROR: The token currently being processed is in an incomplete state. You might have an unbalanced single quoted string or a token
exceeding the maximum length of 65535 characters.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
WARNING: Apparent symbolic reference S not resolved.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
ERROR 180-322: Statement is not valid or it is used out of proper order.
180: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.
ERROR 180-322: Statement is not valid or it is used out of proper order.
NOTE: Enter RUN; to continue or QUIT; to end the procedure.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
ERROR: The token currently being processed is in an incomplete state. You might have an unbalanced single quoted string or a token
exceeding the maximum length of 65535 characters.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
WARNING: Apparent symbolic reference T not resolved.
WARNING: Apparent symbolic reference T not resolved.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
ERROR: The token currently being processed is in an incomplete state. You might have an unbalanced single quoted string or a token
exceeding the maximum length of 65535 characters.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
WARNING: Apparent symbolic reference T not resolved.
WARNING: Apparent symbolic reference T not resolved.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
ERROR: The token currently being processed is in an incomplete state. You might have an unbalanced single quoted string or a token
exceeding the maximum length of 65535 characters.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a
quoted string and the succeeding identifier is recommended.
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
ERROR: The token currently being processed is in an incomplete state. You might have an unbalanced single quoted string or a token
exceeding the maximum length of 65535 characters.
6769
6770 /* region: Generated postamble */
6771 /* Close ODS destinations */
SYMBOLGEN: Macro variable GRAPHTERM resolves to goptions noaccessible;
6772 &graphterm; ;*';*";*/;run;
NOTE: Enter RUN; to continue or QUIT; to end the procedure.
6772! quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: Due to ERROR(s) above, SAS set option OBS=0, enabling syntax check mode.
This prevents execution of subsequent data modification statements.
NOTE: PROCEDURE DATASETS used (Total process time):
real time 2.48 seconds
cpu time 1.06 seconds

6773 quit;run;
6774 ods html5 (id=web) close;
6775 ods listing close;
6776 %if %sysfunc(fileref(_gsfname)) lt 0 %then %do;
6777 filename _gsfname clear;
NOTE: Fileref _GSFNAME has been deassigned.
6778 %end;
6779 %studio_capture_custom_output;
MLOGIC(STUDIO_CAPTURE_CUSTOM_OUTPUT): Beginning execution.
SYMBOLGEN: Macro variable _DATAOUT_NAME resolves to
SYMBOLGEN: Macro variable _DATAOUT_MIME_TYPE resolves to
MLOGIC(STUDIO_CAPTURE_CUSTOM_OUTPUT): %IF condition "&_dataout_name" ne "" and "&_dataout_mime_type" ne "" is FALSE
MLOGIC(STUDIO_CAPTURE_CUSTOM_OUTPUT): Ending execution.
6780 /* endregion */
6781
Tom
Super User Tom
Super User

Remove the %INCLUDE statement.

 

You caused SAS to try and execute the data file as SAS commands.  If the file is appropriate for being read by your data step then it does NOT contain SAS commands.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 7 replies
  • 560 views
  • 1 like
  • 4 in conversation