data get_US_Company_Dataset;
infile '/home/vipendratripathi60/sasuser.v94/Vipen Raw Data Files/US_Company_Dataset.csv' dlm=',' dsd missover firstobs=2 lrecl=50;
length company_name_id $30 company_name city $30 state $2 country $2 company_type $20;
informat date_of_audit mmddyy8.;
input company_name_id company_name year_founded city state country zip_code company_type date_of_audit;
format date_of_audit mmddyy8.;
proc print;
run;
Hello @vipendra and welcome to the community. your sample is unviewable.
Please post you SAS code and sample data in the manner that we can view and use it to assist you.
Maxims of Maximally Efficient SAS Programmers
https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers...
How to convert datasets to data steps
https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...
The macro for direct download
https://gist.githubusercontent.com/statgeek/bcc55940dd825a13b9c8ca40a904cba9/raw/865d2cf18f5150b8e88...
How to post code
https://communities.sas.com/t5/help/faqpage/faq-category-id/posting#posting
Edited as suggested, PDF attachment is for your reference as i am unable to attach in HTML file.
in your length statement what is the length of company_name?
length company_name_id $30 company_name city $30 state $2 country $2 company_type $20;
Its again $30, I have updated in code also.
But my concern is why data is missing or incomplete.
@vipendra you have lrecl = 50. Is that really the length of each record? Or have you not allowed for the 51--?? positions?
@vipendra try to change the lrecl = 50 to lrecl = 256 or something longer, the lrecl = 50 only allows you to obtain the first 50 positions in the record.
what you are getting is
company_name_id $30 company_name for a length of $20 which equals your record length of 50. if your company_name is $30 then those company_names over 20 in length are being chopped off at the end or truncated as one would say.
in the above you say that company_name is $30 but in this link you have company_name with a length of $40
https://communities.sas.com/t5/SAS-Programming/ERROR-22-322-Expecting-a-name/m-p/530456#M145073
try this:
data get_US_Company_Dataset;
infile '/home/vipendratripathi60/sasuser.v94/Vipen Raw Data Files/US_Company_Dataset.csv' dlm=',' dsd missover firstobs=2 lrecl=256;
length company_name_id $30 company_name $30 city $30 state $2 country $2 company_type $20;
informat date_of_audit mmddyy8.;
input company_name_id company_name year_founded city state country zip_code company_type date_of_audit;
format date_of_audit mmddyy8.;
run;
proc print;
run;
LRECL is the length of the record to read. A length of 50 says to read only 50 characters.
You don’t actually need that option. Uploads should be working soon to add attachments, but you can embed an image directly using the ‘photos’ in the editor.
You can also try PROC IMPORT with GUESSINGROWS=MAX and then compare the generated code in the log to yours and find the mistake.
@vipendra wrote:
i want full data in output. and I even don't know how LRECL works.
do you mean each record = each cells in excel ?
if yes then each cells does not exceeds the limit of 30 words in my file.
@vipendra wrote:
Edited as suggested, PDF attachment is for your reference as i am unable to attach in HTML file.
You do NOT need to use an attachment for code, logs or data from a csv file, as all are pure text.
Post the csv into a window opened with the {i} button, and code into one opened with the "little running man" icon.
I cannot open your pdf, there's a "virus scan in progress" next to the attachment.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: