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