BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tanja
Calcite | Level 5

Hello Everyone!

 

I want to capture around 1.5 lakhs of records in CSV files into SAS environment. The sheet contain three character variables (pat_name, product and dose)

While importing, I am missing some text available in the variable product.

It means if the CSV file contain product name as "Atorvastatin hydrochloride", then the imported SAS file display as only part of text i.e."Atorvastatin hydro"

 

proc import datafile="/abc/bcod/sat.csv"
out=qcx
dbms=csv
replace;
getnames=yes;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Proc import for delimited files has an option GUESSINGROWS that tells the procedure how many lines to examine before assigning lengths and types to variables. Without the option SAS only examines the first 20 rows or so by default depending on system options.

Use a largish value like guessingrows=32000 to have a better chance.

 

I recommend this for any Proc Import call where available. Note that large values may increase processing time but the tradeoff may be worth the reduced recoding effort.

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

Look at the log of your import step. You will find the data step code that was created by proc import. Copy that, and adapt the length of the variable in question to your needs.

To remove the line numbers, hold down the alt key while selecting the text to be copied.

ballardw
Super User

Proc import for delimited files has an option GUESSINGROWS that tells the procedure how many lines to examine before assigning lengths and types to variables. Without the option SAS only examines the first 20 rows or so by default depending on system options.

Use a largish value like guessingrows=32000 to have a better chance.

 

I recommend this for any Proc Import call where available. Note that large values may increase processing time but the tradeoff may be worth the reduced recoding effort.

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
  • 2 replies
  • 1798 views
  • 2 likes
  • 3 in conversation