SAS Procedures

Help using Base SAS procedures
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 2351 views
  • 2 likes
  • 3 in conversation