do i need to know the basics of computer science before getting in to programming languages like SAS, R, PYTHON etc?

What have used to learn so far? Like YouTube or books or sites like geeksforgeeks or AI?
Only YouTube
start from the bare basics then, look up a few basic python courses on reddit and go from there, the reason I'm recommending python to you is because it has the least cognitive load syntax wise, its straight forward af and will help you build up the concepts you can apply in other languages. I literally started my SIL from how to print hello world, and stuff like a=10, print(a), before she built up enough basics, for context, she's an analyst and a wizard in Excel, can probably do better than 90% of the data analysts I have seen, but wanted to change streams to get more remote-friendly jobs, granted she already had some basics built up but its just a matter of relating logic which you probably have been applying for years and matching it to programming
JavaScript is good if you want to learn the basics and then move to other languages like C, C++ or Rust the syntax is similar.

Python is easier to learn and a lot of Data Analysts use python, so you won't need to learn a new language.
While python doesn't use {} or ; and stuff, if you mess up the indentation/spacing your code won't work even if you have the right code.
For your use case, python is definitely the better choice.

Use VS Code with python extensions and a formatter.
And here's a channel I would recommend, Bro Code.
You can do both side by side (and what any traditional cs degree puts you through too). I suggest if you like courses check harvard's cs 50 (will teach python) or if you like books "Automate the Boring Stuff with Python". Great intro points into programming.
A common recommendation would be to start with python. But I think from a programmer perspective it is better to start with C or C++. They actually help you on developing your code writing skills rather than applying imported functions.
Also arduino is a good place to start embedded system programming where you could visually see the effects. Just turning on different LEDs connected to the board would help you understand what variables are and how to assign values to them and how they affect the program.
Running a motor with PWM or creating a pattern using LEDs helps in understanding the conditional statements.
Likewise there are many programming logic which you can practically apply and enjoy the results.

Paul McWhorter Videos on YouTube is a great place to learn arduino.