BookmarkSubscribeRSS Feed
ssavor
Calcite | Level 5

I'm reading in an MS Access file: 

 

libname enrsum access path='\\warehouse\freezes_official_2010.accdb'; 

 

Doing some processing on other fields, then writing the data to a file:

 

ods listing close;
ods csv file="t:\201910Tday15.csv" style=minimal;

 

Using a proc print statement: 

 

proc print data=work.RECODE;
var PERSON_UID
    ACADEMIC_PERIOD

    FREEZE_EVENT;

run;

 

The format of the freeze_event from the Access file is 201910TDAY15.  When the proc print puts it in a file, it adds question marks and looks like 201910?T?DAY15. 

 

Why is it doing this and how do I fix it?

 

Thanks.

4 REPLIES 4
ballardw
Super User

Is that variable in the ACCESS database a character variable or a date variable?

The symptom you describe sometimes indicates that a character variable contains characters that either the font you are using for the output (controlled by you active style) does not recognize the value or that there may be an encoding difference between the data base and your SAS session.

Does this have the same appearance if you use an ODS RTF destination instead? CSV files do not contain any font information. So depending on the font your application for viewing the CSV file with may not have definitions for certain characters.

 

Options could include creating a SAS data set and instead of sending results directly from the data base to csv (Access should do that directly) and 1) editing a character field 2) creating a SAS date value and using a SAS date format to display the value 3) changing font in the program viewing the csv 4) changing encoding of the dataset.

You might also change to using PROC Export to CSV instead ODS CSV by selecting the variables in a dataset option.

ssavor
Calcite | Level 5

Thank you.  I will try PROC EXPORT.  It turns out that the field inadvertently had special characters in it and that was causing the problem.

ssavor
Calcite | Level 5

Thank you.  I will try EXPORT.  It turns out that the field inadvertently had special characters in it and that was causing the problem.

andreas_lds
PROC Star

Have you tried using proc export instead of proc print?

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1095 views
  • 0 likes
  • 3 in conversation