BookmarkSubscribeRSS Feed
Lutken
SAS Employee

I often have to google SAS functions that I keep forgetting, and it may take quite some time to find what I'm looking for. Therefore, in this juletip, I will ask ChatGPT to help me with my SAS code.

 

ChatGPT is an open-source model developed by OpenAI that can be used by anyone for free. When asking it questions, it will interact in a conversational way. However, keep in mind that the current version of ChatGPT is trained on data up until 2021. So it can't provide answers that require information from later than 2021. You can read more about it here: https://openai.com/blog/chatgpt/ 

 

Anyway, lets test it out! I will ask ChatGPT how to convert character variables to numeric variables:

 

Lutken_1-1671738298495.png

Lutken_2-1671738342817.png

 

ChatGPT starts by telling what function I can use for this purpose, before it provides several example codes where it uses the proposed function. I must admit that it explains these examples very well so they are easy to understand. Since it interacts in a conversational way, you can also tell it to use the same variables that it previous provided to answer a different question. 

 

Keep in mind that the answers given by ChatGPT are not necessarily always the same. And you should be aware that there may be cases where the answers are not 100% correct. However, it can be a very quick and helpful approach to use when you have these type of questions. Try it out: https://chat.openai.com/chat 

 

If you are interested in other use cases for ChatGPT, check out the previous juletip (#22) as well: https://communities.sas.com/t5/SAS-Community-Nordic/Juletip-22-Tips-to-CAS-Actions-with-a-little-hel...