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

Currently, i have dataset which is combination of multiple txt file. Now, i want to create a variable called Date (the value should be extracted from the description part called start date for each dataset) Can you please help? If you see the start date, it repeats every 133 rows from the first dataset. I want date to be displayed from the each start date.

I am attaching the dataset. [https://docs.google.com/spreadsheets/d/1fswojOKc0WtGh1hVJQfm39p6qf-eAojN/edit?rtpof=true#gid=5924645...]

1 ACCEPTED SOLUTION
10 REPLIES 10
Doc_Duke
Rhodochrosite | Level 12
I get access denied on the google sheet.
Jannet
Obsidian | Level 7
Hi, i have gave access to google sheet, please check ...Also, i have attached the dataset
Kurt_Bremser
Super User

Please post datasets as self-contained data steps with datalines.

Your google drive is not publicly accessible, BTW.

 

From your description, I guess you need to RETAIN date, and set it whenever start_date is not missing.

Jannet
Obsidian | Level 7
Oh sorry....this is imported dataset...so let me send you the dataset ..give me 2 mins
Jannet
Obsidian | Level 7
@Kurt_Bremser, please check the dataset....It would be great help if you can help me ....I am struck here...Also, I want to extract siteID, station number similarly like date and create a variable separately
Kurt_Bremser
Super User

As already stated, the best way to post data is a data step with datalines. No virus scans, no blocking firewalls, and on top we get an exact picture of your dataset, which we NEVER gef from a spreadsheet.

Jannet
Obsidian | Level 7
@Kurt_Bremser actually its a big dataset...it takes time to provide the data step 😞 Hence, i sent u the dataset directly...i gave access to dataset in google sheet...plz try if it works
Kurt_Bremser
Super User

So you get that as text files. Please open such a text file with an editor (do NOT open it with Excel!) and copy/paste the header and the first few data lines into a window opened with the </> button. We can then provide you with code that reads the data correctly from the text files in the first place.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 10 replies
  • 1452 views
  • 0 likes
  • 3 in conversation